use the Canvas link to submit the team's work
Educational goals of this lab - verify that every student can
INSTRUCTIONS:
(90 points) Team Problem:
Description of problem:
This program will be a guessing game "Find the Mystery Point". The program picks a random point on the screen (no fair picking one OFF the screen!) It allows the user to click on the screen to see if they can find the mystery point. The way they 'find' it is to come within 10 units of the mystery point, distance calculated by a function given below. The user is informed how many guesses they have taken so far and how far away they are from the mystery point. They keep clicking until they find it. The program tells them they found it.
(10 points) Problem #1: Complete a test plan.
Description | Input
(number of clicks) | Expected behavior/output |
---|---|---|
One click and game over | one click, within 10 units of mystery point | _____A._____ |
One click, game not over | one click, farther than 10 units away from mystery point | _____B._____ |
Note that the only way to have ZERO clicks is to hardcode the mystery point ahead of time, then the user clicks on it (not much of a game).
(10 points) Design
Design is given. Write three P's as usual.
Sample run:
(70 points) Implementation:
You must use (call) these functions.
def distance (pt1, pt2): #purpose: calculate the distance between 2 graphics Points #pre-conditions: two Point objects #post-conditions: returns distance using distance formula return ((pt1.getX() - pt2.getX())**2 + (pt1.getY() - pt2.getY())** 2) ** 0.5 def drawPoint(pt, color, win): #purpose: draw a Circle of radius 3 at location given by pt with the color specified on the GraphWin win #pre-conditions: pt is a Point object which acts as center of circle, color is string, win is GraphWin object used to draw on #post-conditions: a colored Circle of radius 3 is drawn on win, center at location given by pt c = Circle(pt, 3) c.setFill(color) c.draw(win)