Question: ( 1 0 points ) Design in Python Design is given. Write three P ' s as usual. - Build a graphics window, size is

(10 points) Design in Python
Design is given. Write three P's as usual.
- Build a graphics window, size is your choice.
- Use random numbers to choose a location on the window. Use them to build a Point, but don't draw it YET!
- Use a Text object to tell the user to click on the window.
- Get the user's guess by getting the Point that they click on.
- Draw an orange pumpkin at the point they guessed USE GIVEN FUNCTION
- Initialize a counter for the guesses, using what value??
- Use a Text object to display the counter with a label (draw it)
- Get the distance from the user's guess to the Black Cat. USE GIVEN FUNCTION
- Make a Text object with the label "Distance" and draw it. Don't put a number in it yet.
- While the integer result of this distance is greater than 10,
- use setText to output the distance (cast to integer) to the screen with label
- get another guess from user
- draw an orange pumpkin at the point they guessed USE GIVEN FUNCTION
- count the guess
- update the displayed counter
- find the distance between the new guess and the Black Cat USE GIVEN FUNCTION
- Report that the user found the Black Cat
- Draw a White circle where the Black Cat was revealed USE GIVEN FUNCTION
- Get another click so program will pause
- close window
(70 points) Implementation:
- Include the given design and write the program.
- Two function definitions you paste into your program,
- Not defined within the main() function.. must be defined BEFORE or AFTER main() definition
- You must call these two functions ( TWO GIVEN 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 6 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 6 is drawn on win, center at location given by pt
'',
c = Circle(pt,6)
c.setFill(color)
c.draw(win)
```
-(5 BONUS POINTS)
Change the program so that if you can't find the Black Cat within 15 clicks, the program stops the game, shows you where the Black Cat was hidden and tells you that you didn't find it.
- Submit this final program with your team members' names (the ones who were present at lab) using the Canvas link.
- Make sure that all members of the team understand the team result.
Sample screens while playing the game:
Halloween Hunt - Find the black cat
Click to find the black cat
distance
guesses
Halloween Hunt - Find the black cat
Click to find the black cat
Distance 429
Guesses: 1
THE BLACK CAT IS CLEVER!!
The trick is practice, try again
Click to Close
distance 400
Guesses: 15
Halloween Hunt - Find the black cat
YOU FOUND THE BLACK CAT!!
What a treat!
Click to Close
( 1 0 points ) Design in Python Design is given.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!