” CS5001程序 写作、Python编程调试CS5001 Spring 2021 Final ProjectDeadline: April 23rd at 12:00 noon ETTo submit your solution, compress all files together into one .zip file. Login to handins.ccs.neu.edu withyour Khoury account, click on the appropriate assignment, and upload that single zip file. You maysubmit multiple times right up Until the deadline; we will grade only the most recent submission.NOTE: You may NOT use late days for this assignment. Any project turned in after the deadline willreceive an automatic zero! Manage your time well and be sure to submit something well before thedeadline.End ProductYour files to turn in:mastermind_game.py (includes a main() function that lets us play your game)test_mastermind_game.py (tests for game functions, does not test turtle/view)readme.txt (short plaintext file 1 or 2 paragraphs explaining your design and any extra creditfunctions you attempted)You may turn in other files with helper Functions, but these above files are the minimum required. Thecode may be written as classes and objects or procedurally, although some functions will be required tobe outside of classes for our testing hooks. See below for the functions required for testing hooks.Include any and all files required for playing your game, including gifs (either ones we provided for you orcustom ones that you created) and any starter code you used, whether you modified it or not. We shouldbe able run mastermind_game.py in IDLE and play your game as you intend it to look for us.The Game: MastermindMastermind ( httpss://en.wikipedia.org/wiki/Mastermind_(board_game)) is a coding-breaking board gamefor two players. The secret code is a set of 4 colors chosen out of a possible 6 colors, where the playerneeds to guess which colors are in which positions in the 4-color secret code. After each guess, theplayer learns how many colors in their guess are in the right position, and how many had a color thats inthe code but the color is in the wrong position. Scoring pegs of different colors were used to show themhow many correct guesses and how many correct positions they had gotten with their guess. Red pegs4/11/2021 Project httpss://northeastern.instructure.com/courses/63359/assignments/870914?module_item_id=5358167 2/7meant a correct color but out of Position, black pegs meant a correct color in the correct position. Thesescoring pegs after each guess can be placed in any order the player never knows _which_ colors arecorrect and/or in the correct position. Examples of the two-player version of the game being played canbe seenhere ( httpss://www.youtube.com/watch?v=dMHxyulGrEk)( httpss://www.youtube.com/watch?v=dMHxyulGrEk)andhere ( httpss://www.youtube.com/watch?v=wsYPsrzCKiA)( httpss://www.youtube.com/watch?v=wsYPsrzCKiA).In an older version of Mastermind, called, Bulls and Cows, guesses with correct position were calledbulls, and correct guesses with incorrect positions were called cows. We will use the bull and cowterminology when talking about correct guesses for Mastermind.Our Version of Mastermind: 1 playerWell be designing a version for one player. In your version, the program selects the 4 color secret code.Your program will also place the scoring pegs. In some versions of Mastermind, blank positions areallowed, and/or duplicate colors are allowed. You can play a one-person version of the game here( httpss://www.archimedes-lab.org/mastermind.html) ; this version allows duplicate colors. Our version willnot allow blank positions or duplicate colors (but see Extra Credit, below). Our permitted colors are:colors = [red, blue, green, yellow, purple, black].In the one-player game, the score is the number of guesses it takes the player to guess the code. Theplayer loses if they dont guess the code in 10 tries. Lower scores/fewer guesses are better. Our scoringpegs will be red for cows and black for bulls.Prof Keith posted Walkthroughs and examples of the game play and expected functions for thegame, which can be found on Piazza here ( httpss://piazza.com/class/kjyf0wctcts1no?cid=313) .Game Play Functions4/11/2021 Project httpss://northeastern.instructure.com/courses/63359/assignments/870914?module_item_id=5358167 3/71. We should be able to input the player name to your game through a pop-up window rather than in theterminal.2. Your program should draw a board as seen in the demo videos. This board for the Mastermind gameshould include:a Leaderboard on the right that lists the previous best scores in the game (lowest scores arebest).A Quit button that exits the game. We provide a gif for this button in the starter code.A set of clickable, colored guess buttons that allows a player to choose one color at a time for aguess, and does not allow them to choose duplicate colors (unless you have implemented thecomplete option in Extra Credit). We provide starter code for these buttons in Marble.pyA green check mark button that confirms that a guess should be checked/entered. We provide agif for this button in the starter code.A red X button that removes a guess that has not yet been checked/entered and resets theclickable, colored guess buttons. We provide a gif for this button in the starter code.A representation of the board that displays the current guess and previous guesses in this game.We provide starter code for these buttons in Marble.py .A part of the display that shows the scoring pegs. These scoring pegs are filled in after a guess ischecked, with black pegs indicating colors guessed in the right position, and red pegs indicatingcolors guessed correctly, but not in the right position. Blank circles can represent neither of thoseconditions.3. Your program should save the best scores in a leaderboard file, and when the program is relaunched,those scores should be visible with the player name in the leaderboard. A minimum of 2best scores should be saved. The list should update with new best scores when someone achieves anew best score. Do not submit your leaderboard.txt file with your submission; a new file should becreated if one does not exist yet.4. The program should display a visual error message popup if the leaderboard file cannot be found.We provide a gif for this message in the starter code.5. The program should display a visual message popup if the player presses the Quit buttons. Weprovide a gif for this Message in the starter code.6. The program should display a visual message popup if the player wins or loses. We provide gifs forthese messages in the starter code.All user interaction should be via your turtle-based user interface; users must use the mouse to play yourgame (the only keyboard Actions are when you capture the player name at the start of the game)Test SuiteYour test file should test all the functions in your game that dont involve turtle (and remember, for gooddesign and separation of concerns, turtle drawing functions should be separate from game functions).Test edge cases and exceptions.4/11/2021 Project httpss://northeastern.instructure.com/courses/63359/assignments/870914?module_item_id=5358167 4/7Starter CodeThe starter code described below can be found here( httpss://northeastern.instructure.com/courses/63359/files/8964749/download?download_frd=1) .Using our starter code is optional. You can customize this game as you like, modify the starter code, ornot use it at all. We will be providing you with these files:Point.pyThis file contains a class Point With two attributes, x and y. It represents a geometric point with xand y coordinates. It has two methods:delta_x, which takes as input another Point, and returns the absolute distance of the differentbetween this point and the other points x coordinates,delta_y, which takes an input another Point, and returns the absolute value of the differencebetween this point and the other points y coordinates.Marble.pyThis file contains a class Marble with the attributes pen, color, position, visible, is_empty, andsize. This class can draw an empty Marble and set its color, get its color, erase itself, anddetermine if it has been clicked. This class requires the use of the class Point.A whole bunch of .gif files:checkbutton.gif, a green check mark for the check buttonfile_error.gif, a file error popup messageleaderboard_error.gif, a leaderboard access error popup messagelose.gif, a popup message for when the player losesquit.gif, a red square for the quit buttonquitmsg.gif, popup message for when the player quitswinner.gif, a popup message for when the player winsxbutton.gif, a red X for the cancel buttonNote: none of the popup messages actually pop up, theyre just gifs that you have to write the code tomake them open in a new window, etc.Required Testing HooksYour mastermind_game.py file must include the following function, provided outside of any classes if youare using classes:count_bulls_and_cows(secret_code, guess)This function takes as input two lists: the first parameter is the secret code and the second parameteris the user guess.This function returns a 2-tuple (a tuple with two elements) containing the number of bulls and cowsby comparing with the secret code. The secret code and guesses are in the form of a list of strings4/11/2021 Project httpss://northeastern.instructure.com/courses/63359/assignments/870914?module_item_id=5358167 5/7from the options:colors = [red, blue, green, yellow, purple, black]this function doesnt need to run anything in your game view it just needs to work as stated.Program EvaluationWe will test your code using count_bulls_and_cows() with automated testing, and we will also playyour game.Well be looking for the functionality described in this document and shown in the demo videos forprogram correctness.Document your code extensively, following all the guidelines youve learned through the semesterand whats in the Style Guide for the course.Make your code readable, Following the style guide with good variable names, good function writing,well-formed and clear classes if youre using classes, good use of whitespace, and all the other codereadability guidelines youve learned throughout the semester. Readability and documentation geteven more important the longer and more complicated your programs get!Keep your code as efficient as possible dont do anything twice that you only need to do once, etc.Instead of AMAZING points, well use those 2 points for UI Aesthetics, which we will use to assess theoverall UI aesthetics and user experience.Extra CreditBonus points above 100 can be earned for adding the following functionalities. Do _not_ try to work onthese functionalities until youre sure you have a finished, working project to hand in that has all of therequired functionalities!If you include any of these extra credit options, document them extensively in your code as well as inyour readme.txt.Allow duplicate colors to be used in the secret code and in guesses for your game. This makes thegame substantially harder to win in 10 guesses. +5 pointsAllow blanks in the secret code and in guesses in the game. In count_bulls_and_cows(), blanksshould be represented by the empty string. No points are given for only implementing this incount_bulls_and_cows(): it must be a part of the visual representation of your game. +3 pointsAllow players to play multiple rounds of the game without quitting out of the application. Make surethe high scores update between games, but dont require the player to put their name in again. +5points4/11/2021 Project httpss://northeastern.instructure.com/courses/63359/assignments/870914?module_item_id=5358167 6/7Notes and Guidance to Help YouImportant: Your project MUST be runnable and do something non-trivial to get credit for thisassignment. However, it does not need to be functionally complete to get partial credit.ResourcesThis project will have you using a bit of almost everything we learned this semester (except recursion),so be sure to allocate Appropriate time to complete it. If you wait until the last minute to work on this, youare almost guaranteed NOT to finish on time. You cannot use late days on this project, because we havea deadline for turning in grades. Plan to start early!At the same time, dont panic. The project is bigger than anything youve worked on this term, but theconcepts are all within your reach. Youll need to do a bit of reading on Turtle to brush up on theelements youll likely need for the graphics. In particular, review the turtle objects themselves and thinkabout how you can use multiples of them to do things on the gameboard for you.A link to Python Turtle documentation ishere: httpss://docs.python.org/3/library/turtle.html#turtle.update (Links to an external site.)( httpss://docs.python.org/3/library/turtle.html#turtle.update)Feel free to search the web for other Turtle resources to help you learn whatever you think you mightneed to know for the UI portion of your application.Pro-TipYou likely will NOT be able to complete this project in one day. Work a little bit EVERY day (even if itsrefactoring your code) to make progress. Have a plan and work towards smaller milestones to keep yourdevelopment on pace for completion. If you havent planned a project before, a sample work plan isbelow. Feel free to use it as a rough guide if youre not sure how to get started. (Youll need to act asyour own project manager and writing down some timeboxed goals will likely be helpful).Work PlanHere are some of the things I did when creating the sample solution (NB: Im a Turtle novice like many ofyou, so I had a learning curve here too). Im including some sample timeboxes you can adjust these tosuit your working style and progress.Milestone 1: Mastermind / Bulls Cows modelGoal: Implement the fundamentals for basic game without worrying about the graphics yet. Develop thefunctionality to generate a Randomized secret code and the ability to test user input viacount_bulls_and_cows(). Dont spend a lot of time with an elegant textual interface; you just want to getthe core of the game model working so you can use it later.4/11/2021 Project httpss://northeastern.instructure.com/courses/63359/assignments/870914?module_item_id=5358167 7/7[1 day ]Milestone 2a: Turtle Pre-work Exploration (In agile terms, this would be called a spike where weexplore any technology were a bit shaky on, so we can learn gain confidence before trying to use it).Goal: Review how to draw shapes, capture mouse clicks, use turtle objects to render .gif images in theproper locations, etc.. Turtle also has some rudimentary dialog box functionality like what you see meuse in the video to get the player name. Its pretty straightforward, but youll need to read thedocumentation to see how to use it. Some of this code will be throw-away but its a learning exercisebefore digging in.[1 day]Milestone 2b: Develop Gameboard Write the code to create the entire game board: The play area,status area leader board. Validate the code works with dummy data.[1 day ]Milestone 3: Marble placement behavior: Write the code to manage proper Marble placement for thegame AND the Marble Guess Panel (at the bottom of the screen where the user selects the colors theywant). If youre using our Included Marble code, youll likely want to spend a little time examining thatcode and seeing how to use it. Check your layout algorithm to make sure it works for placing each UserGuess in the correct spot. Implement code to handle mouse clicks selecting Marbles appropriately.[3 days]Milestone 3: Game behavior: Write the code to implement the game rules. Plug yourcount_bulls_and_cows()code into your Application code so that the guess pegs can be updated properlygiven a user guess. Write the code to update the row marker every time the user enters a new guess.[3 days]Milestone 4: Leaderboard clean up: Write the code to implement saving/retrieving and showing realcontents of the leader board. Clean up code, continue to test.[2 days]Milestone 5: Write readme.txt: Write readme.txt. Do any extra work for bonus points as desired. Anyother outstanding clean up.[1 day ]Release: Before Noon, April 23rd: Ship It!请加QQ:99515681 或邮箱:99515681@qq.com WX:codehelp
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。