讲解:CS 177、Python、Python、Boiler Gold HuntSPSS|Haskell

CS 177 Fall 2018This is an individual assignment – complete it on your own.Page 1 of 5Project 2Due Date:This project is an individual assignment – you should complete it on your own, without help or assistancefrom others even if they are not taking CS 177. Submit your completed program to the Project 2assignment on Blackboard by 11:59 pm, Friday November 9th.Problem Description: Boiler Gold Hunt!You have been asked to create a game called Boiler Gold Hunt where the player has to search for asingle gold Circle hidden within a 15 x 15 grid of black Circles with a radius of 15. The game is playedin 5 rounds and the player attempts to find five (5) gold Circles (one in each round). The player’s finalscore is the total number of clicks it takes to find all five hidden, gold Circles. The game must be writtenin Python, use only the graphic objects available in the Graphics library and allow the player to interactwith the game using the mouse. The program must include a game control panel allowing users to entertheir name, start a new game and exit the program. Player’s scores and statistics must be tracked in atext file named scores.txtPlayers begin by entering their name in the PLAYER NAME box and clicking on the NEW GAME control inthe control panel. At any time, even in the middle of a current game, players can reset the board and starta new game by clicking the NEW GAME control. They can also change the current player name.At the start of each round, the program determines a random location for the hidden, gold Circle anddisplays a 15x15 grid of black Circles representing the game board. Clicking on any black Circle willreveal its hidden color (white, grey, tan or gold) which gives the player a clue to finding the hiddengold Circle. (You can see a demonstration of the game in the Project 2 video posted on Blackboard)The hidden color assigned to a given Circle depends on it’s distance from the hidden gold CircleColor Distance from the Gold Circlewhite 3 or moregrey 2 awaytan 1 awayNote: While each Circle is assigned a color at the beginning of a round, it is actually drawn with a blackfill and the hidden color is revealed when it is clicked.A Round ends when the gold Circle is found and the game ends after five Rounds. At the end of eachgame, the player’s name and score (total number of clicks) are stored in the scores.txt file whichcontains the names of previous players and their scores. This file should be sorted in ascending order, ie:lowest number of clicks first -- highest number of clicks last.This is an individual assignment – complete it on your ownPage 2 of 5Part 1: Setup your project2.py Python program fileStart 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 needThe project2.py program must include pseudo code (comments) throughout the programdescribing each function, section of code and logical decision.Part 2: Create the Game Control PanelWrite a new function that completes the following tasks: Create a 250 x 200 Graphics window with a light-greybackground titled Game Control Using Rectangles, Entry, Text objects and any otherGraphics elements you need, create the elements in theGame Control Graphics window as shown in theexample The gold BOILER GOLD HUNT! title text is boldand in all capital letters The NEW GAME and EXIT controls are Rectangles NEW GAME (gold), EXIT (black) The PLAYER NAME control is a white filled Entry box The Text objects should be drawn using the size, color and font shown The Game Control window should match the colors, font sizes and design shown This function should return the Player Name, New Game, Exit and Game ControlGraphics window objects.Part 3: Create the Boiler Gold Hunt WindowWrite a new function that completes the followingtasks: Create a 480x520 Graphics window titledGoldHunt Draw a 480x40 black Rectangle at the topof the GoldHunt window as shown in theexample Create the Round and Clicks Textobjects as shown in the example This function should return the Round,Clicks and GoldHunt Graphics windowobjectsThis is an individual assignment – complete it on your ownPage 3 of 5Part 4: Create the main() functionWrite a function named main() that completes the following tasks: Call the function that creates the Game Control graphics window – don’t forget to assign theGraphics objects it returns to variables Call the function that creates the GoldHunt graphics window assigning the Graphics objects itreturns to variables Using a while loop, the main() function should repeat until a mouse click is detected on the EXITcontrol in the Game Control graphics window After the while loop ends, close all graphics windowsTest your main() function to verify that it operates correctly, closes the Graphics windows when EXIT isclicked and there are no error messages.Part 5: Create the Circle grid in the GoldHunt windowWrite a function using Lists and Circle objects that completes the following tasks: Display the current PLAYER NAME (bold, gold Text) aCS 177作业代做、代写Python实验作业、代做Python语言程序作业、代写Boiler Gold Hunt作业 t the center of the top black border Creates a 15x15 grid of black-filled Circles in the GoldHunt graphics window as shown below Stores the black Circles as elements in a List Create a List assigning each Circle a fill color that will be revealed after the Circle is clicked One Circle at random is assigned gold fill color Assign tan fill color to Circles next to the gold Circle Assign grey fill color If they are two away from thegold Circle Assign a white fill color to Circles that are more thantwo away from the gold Circle Return the Lists containing the Circles and color assignmentsHidden Circle color assignmentsThe Circle grid at the start of a roundThis is an individual assignment – complete it on your ownPage 4 of 5Part 6: Enable game play!Modify the main() function and write any other necessary functions to enable game play. A detaileddescription of the game play and rules follow here: Players must enter a name and click the NEW GAME control to start a game The NEW GAME control should only function if the PLAYER NAME Entry box is not empty When the NEW GAME control is clicked and at the start of every Round, a 15x15 grid of blackCircles (radius 15) is displayed in the GoldHunt graphics window (see below) The black banner at the top of the GoldHunt graphics window displays the player’s name, thecurrent Round number and the total number of Clicks in the current game The Round number and Clicks start at 0 and increaseas the game progresses A game includes a total of five (5) Rounds Clicks on a black Circle will reveal its assigned “hidden”color (white, tan, grey or gold). A Round ends when the gold Circle is found At the end of a Round, all Circles except for the gold areanimated, appearing to fall from the GoldHunt graphicswindow before a congratulatory message is displayed At the end of the game, the player’s score is the totalnumber of clicks it took for them to find the gold Circle inall five (5) rounds After five (5) rounds, the player’s name and total numberof clicks are saved in the scores.txt file The scores.txt file should be sorted by number ofclicks in ascending order (ie: lowest to highest number of clicks) A sample scores.txt file is provided with the Project 2 assignment and can be used with yourprogram A player can start a NEW GAME at any time even while a game is in progress If the NEW GAME control is clicked, (and the PLAYER NAME control is not empty), any game inprogress will end immediately and a new one begin without saving the current score The program can be terminated by clicking the EXIT control at any time, even while a game is inprogress When the EXIT control is clicked, both Graphics windows should close without errors and theprogram should endThe video shown with in Project 2 assignment on Blackboard should be helpful in understanding thegame play process and requirementsThis is an individual assignment – complete it on your ownPage 5 of 5Submit your completed project2.py Python programSubmit your completed program to the Project 2 assignment by 11:59 pm on Friday November 9thProject 2 Grading Rubric PointsPart 1: Program has correct filename project2.py 5Part 1: Program includes header with student name, the program name and a description 5Part 1: Program is fully documented with comments for functions, decisions and functionality 10Part 2: Separate function creates Game Control Graphics window as specified 5Part 2: Function creates all Graphics objects as shown 10Part 2: Function returns all required Graphics objects 5Part 3: Separate function creates GoldHunt Graphics window as specified 5Part 3: Function creates all Graphics objects as shown 10Part 3: Function returns all required Graphics objects 5Part 4: main() function is defined 5Part 4: main() function properly calls the function to create the Game Control window 5Part 4: main() function properly calls the function to create the GoldHunt window 5Part 4: main() function includes a while loop that ends when the EXIT control is clicked 5Part 4: main() function closes all Graphics windows without errors 5Part 5: Separate function creates a List of black Circles 10Part 5: Function uses List to store “hidden” colors for the List of Circles 5Part 5: Function randomly assigns gold to one Circle 5Part 5: Function correctly assigns white, grey and tan colors to remaining Circles 10Part 5: Function draws the black Circles in a 15x15 grid in the GoldHunt window 5Part 5: Function returns the Lists of Circles and color assignments 5Part 6: Players can click NEW GAME control to start over at any time (even during gameplay) 5Part 6: NEW GAME control works only when PLAYER NAME is not empty 5Part 6: Black banner in GoldHunt window displays player name, round and number of clicks 5Part 6: Game ends after 5 rounds -- Rounds end when gold Circle is revealed 5Part 6: When Rounds end, Circles are animated as specified and message is displayed 10Part 6: When game ends, players name and score are saved to scores.txt file as specified 10Part 6: Players can click EXIT control to quit at any time (even during gameplay) 5Style / Format: Python code is formatted well, organized and easy to understand 10Total Points 180转自:http://ass.3daixie.com/2018110722443923.html

你可能感兴趣的:(讲解:CS 177、Python、Python、Boiler Gold HuntSPSS|Haskell)