[SOLVED] 代写 game python graph CS 177

30 $

File Name: 代写_game_python_graph_CS_177.zip
File Size: 292.02 KB

SKU: 0889173780 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


CS 177
Fall 2019
Project 2
Due Date:
This project is an individual assignment – you should complete it on your own, without help or assistance from anyone other than the CS 177 staff. Submit your completed program to the Project 2 assignment on Blackboard by 11:59 pm, Sunday November 3rd.
Problem Description: Guess Master 2.0
You have been asked to enhance the game you created in Project 1 to create Guess Master 2.0. In this graphical version of the game, the player must still guess the letters in a random word selected from the words.txt file, however in each round when a player correctly guesses all the characters in a word, a new round begins and they have a new word to guess. Players earn points as they win each round.
The program must be written in Python, using only the graphic objects available in the Python Graphics library, and must allow the player to continue playing until they choose to exit the game. The program must include a CONTROL PANEL graphics window providing two (2) controls:
1. NEW – Starts a new game
2. QUIT – Exits the program
See figure 1 for an example of the CONTROL PANEL.
Game Play
A game begins when the player clicks the NEW control and ends
when a player cannot guess a word within ten (10) tries. When
the NEW control is clicked, the program opens the GAME PANEL Graphics window displaying a large
Figure 1 – the CONTROL PANEL
SCORE: 10
BLOCK P and a series of black-filled Circles displaying the characters A to Z, (see figure 2 for an example). Above the BLOCK P are several Rectangles representing the number of letters in the secret word. When the player clicks the character Circle to guess a letter, incorrect guesses cause a piece of the BLOCK P to turn red and “fall away”, revealing their white-filled outline. Correct guesses will result in the letter appearing in the appropriate Rectangle above. As letters are guessed, the corresponding Circle fill color is changed to gold. In figure 2, the letters L, N, R, S and T have been guessed and three were incorrect causing three pieces of the BLOCK P to fall away.
If the player successfully guesses all the letters in the word, the GAME PANEL , BLOCK P and Circle colors are reset and the player is given a new word with ten (10) guesses to reveal its characters.
Figure 2 – the GAME PANEL
This is an individual assignment – complete it on your own.
Page 1 of 6

CS 177 Fall 2019
Scoring the Game
Each word to be guessed represents a “round” in the game. If the player guesses all the letters in a word, they’ve won that round and the game automatically chooses a new, random word and starts a new round. This continues until the player cannot reveal all the letters in a word before losing all ten (10) pieces of a BLOCK P.
Players can earn up to 10 points in each round. Each incorrect letter guessed reduces their round score by 1 point. If after 10 guesses they have not guessed all the letters in the secret word, they lose the round and the game is over. An example of the scoring follows here:
Round Secret Win or # Wrong Round Total Number Word Lose Guesses Score Score 1 RAIN Win 6 4 4
2 WAGON Win 5 5 9
3 SETTLE Win 8 2 11
4 DUTCH Lose 10 0 11ßGAME OVER
Scoring Example Explanation: This player played for four rounds. They correctly guessed the letters of the first three round secret words, (RAIN, WAGON and SETTLE) but did not correctly guess the word DUTCH in round four which ended the game. Players can earn up to 10 points in each round, with one point deduction for each incorrect guess. In this example the final score was 11.
Animportantnote: TheNEWandQUITcontrolsin the CONTROL PANEL window will be functional at all times – even when a game is in progress. The player should be able to choose to continue playing their current game, start a new game or leave the program any time, at their own discretion. The program should be checking for and responding to clicks in either Graphics window.
SCORE: 9
Figure 3 – A winning round
This is an individual assignment – complete it on your own.
Page 2 of 6

CS 177 Fall 2019
Part1: Setupyourproject2.pyPythonprogramfile
Start a new Python program file that meets the following parameters:
• The filename must be project2.py
• Include a header with your name, the program name and a short description of its functionality • Import the Graphics library and any other libraries you will need
• The project2.py program must include pseudo code (comments) throughout the program
describing each function, section of code and logical decision.
Part 2: Create the Control Panel
Write a new function that completes the following tasks:
• Creates a Graphics window with a light-grey background titled Welcome to:
• Using Rectangles, Entry, Text objects and any other Graphics elements you need, create the
elements in the CONTROL PANEL Graphics window as shown in the example
• The gold GUESS MASTER 2.0 title text is bold, gold and in all capital letters
• The NEW and QUIT controls are Rectangles
• NEW (gold) and QUIT (black)
• The CONTROL PANEL window Graphics objects should match
the colors, font sizes and design shown in the example
• HINT: The function should return the Graphics objects
Part 3: Create the Game Panel
Write a new function that completes the following tasks:
• Create the GAME PANEL Graphics window titled Save the Block P with a gold background
• Draw two rows of 13 black-filled Circles near the bottom of the GAME PANEL window as shown in
the example below
• Place a single white Text object within each of the 26 black Circles as shown in the example
• Draw a series of 10 white-filled Polygons to create the BLOCK P shape as shown below
• Draw a second series of black-filled Polygons creating the BLOCK P and covering the white
Polygons. This allows the program to animate the black-
filled shapes during gameplay, revealing their outlines
• Using a technique similar to randomly Project 1, select a
secret word from the words.txt datafile
• Draw a series of gold-filled Rectangles representing the
characters in the secret word (see figures 2 and 3)
• HINT: Store the Circles, Polygons, Rectangles and Text
objects in Lists. This will allow you to change their
properties later
• This function should return the Graphics objects and the
secret word selected
This is an individual assignment – complete it on your own.
Page 3 of 6

CS 177 Fall 2019
Part4: Thedrop()function
Write a new function named drop() that accepts a Polygon object as an argument and completes the
following tasks:
• Change the fill color of the Polygon to red
• Animate the Polygon to appear to “fall” down out of the Graphics window
(HINT: Use a loop that moves the Polygon a few pixels at a time in the Y direction until it is no
longer visible in the GAME PANEL Graphics window)
• The drop() function does not return any values
Part 5: Putting it all Together
The program should start with the main() function and should follow this logical process:
• Create the CONTROL PANEL Graphics window
• Check for a click on the NEW or QUIT controls
• If the QUIT control is clicked:
• Close the CONTROL PANEL Graphics window
• Program ends
• If the NEW control is clicked, start a new game as described in Part 5: Playing the Game
Part 6: Playing the Game
All games start at round 1 and progress through multiple rounds until the player cannot correctly guess all the letters in the secret word. At the start of a round:
• Create a new GAME PANEL Graphics window as described in Part 3
• If this is round 1, set the player’s score to 10
• If this is not round 1, add 10 points to the player’s score
• Create a score Text object at the top of the GAME PANEL (see figures 2 and 3) and display the
characters “SCORE: ” + the player’s current score
• Check for clicks on the NEW or QUIT controls or any of the black “letter” Circles
HINT: Use the .checkMouse() function
• If QUIT control is clicked:
§ Close the CONTROL PANEL Graphics window § Close the GAME PANEL Graphics window
§ Program ends
• If NEW control is clicked:
§ Close the GAME PANEL Graphics window
§ Set the player’s score to 0 and restart the game as shown in Part 5: Playing the Game
• If a click is within one of the letter Circles:
§ Change the clicked Circle fill color to gold and the Text character color to black
§ Determine the character guessed (clicked)
§ Check for all occurrences of the guessed character in the secret word
(HINT: This is similar to Project 1)
§ For all occurrences of the guessed character in the secret word, create it as a Text
object within the appropriate gold Rectangle above the BLOCK P (see figures 2 and 3)
§ If the guessed character is not in the secret word:
§ Decrease the player’s score by 1 point and update the score Text object
§ Animate the loss of one of the BLOCK P Polygons using the drop() function
This is an individual assignment – complete it on your own.
Page 4 of 6

CS 177
Fall 2019
Part 7: Winning a Round
If all the characters in the secret word have been guessed correctly:
• Update the score Text object
• Create Text objects indicating a winning round as shown in figure 3
• Wait for a mouse click inside the GAME PANEL Graphics window
• Close the GAME PANEL Graphics window
• Increment the round number and start a new round as shown in Part 5: Playing the Game
Part 8: Losing a Round
The round and game are over if the player has made ten (10) incorrect guesses, all of the black BLOCK P Polygons should be gone.
• Update the score Text object
• Create bold, red Text objects indicating the game is over
(HINT: These will be similar to the Winning Round Text objects)
• Wait for a mouse click inside the GAME PANEL Graphics window
• Close the GAME PANEL Graphics window
• The only Graphics window open at this point will be the CONTROL PANEL allowing the player to
click on either the NEW or QUIT controls.
Submit your completed project2.py Python program
Submit your completed program to the Project 2 assignment by 11:59 pm on Sunday November 3rd
This is an individual assignment – complete it on your own.
Page 5 of 6

CS 177 Fall 2019
Project 2 Grading Rubric Points
Part 1: Program has correct filename project2.py
Part 1: Program includes header with student name, the program name and a description
Part 1: Program is fully documented with comments. All Python commands are within Functions Part 2: Separate function creates CONTROL PANEL Graphics window
Part 2: Function creates all CONTROL PANEL Graphics objects as shown in figure 1
Part 2: Function returns all required Graphics objects
Part 3: Separate function creates GAME PANEL Graphics window
Part 3: Random secret word is selected from words.txt datafile
Part 3: Function creates all Graphics objects as specified and shown (figures 2 and 3)
Part 3: Function returns all required Graphics objects and the secret word
Part 4: drop() function is defined and accepts a Polygon object as an argument
Part 4: drop() animates the Polygon object to appear to “fall” down out of the window
Part 4: drop() does not return any values
Part 5: main() function is defined as specified and calls function to create the CONTROL PANEL Part 5: If QUIT control is clicked, Graphics windows are closed without errors
Part 5: If NEW control is clicked the game begins
Part 6: GAME PANEL is created as specified
Part 6: Clicks on QUIT or NEW controls function as specified
Part 6: Player guesses (clicks on black Circles) function as specified
Part 6: Incorrect guesses decrease score and drop() function is called as specified
Part 6: Correct guesses reveal all occurrences of character in the Rectangles above BLOCK P Part 7: If all characters have been revealed, score is updated and “winning” Text is displayed Part 7: Program waits for mouse click, then closes GAME PANEL
Part 7: Round number is incremented and new round begins as specified
Part 8: If ten (10) incorrect guesses of secret word, score updated and “losing” Text is displayed Part 8: Program waits for mouse click, then closes GAME PANEL.
Player can click NEW or QUIT controls to at any time (even during gameplay)
Style / Format: Python code is formatted well, organized and easy to understand
5
5 15 5
10 5 5
10
15
5
5
15
5
5
10
5
15
5
10
10
15
10
5
5
10
5
25
10
Total Points
250
This is an individual assignment – complete it on your own.
Page 6 of 6

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 game python graph CS 177
30 $