Question: Mastermind is a code-breaking game for two players (https://en.wikipedia.org/wiki/Mastermind hidden code that consists of 4-5 code pegs. 2.1 The Board Game Original Mastermind The
Mastermind is a code-breaking game for two players (https://en.wikipedia.org/wiki/Mastermind hidden code that consists of 4-5 code pegs. 2.1 The Board Game "Original Mastermind" The board game is played using: a decoding board, with a shield at one end covering a row of four large holes, and twelve (or ten, or eight, or six) additional rows containing four large holes next to a set of four small holes; code pegs of six different colours (Red, Green, Blue, Yellow, White, Black), with round heads, which will be placed in the large holes on the board; and (board game)). The goal of the game is to discover a key pegs, some coloured black, some white, which are flat-headed and smaller than the code pegs; they will be placed in the small holes on the board. The two players decide in advance how many games they will play, which must be an even number. One player becomes the codemaker, the other the codebreaker. The codemaker chooses a pattern of four code pegs. Duplicates and blanks are allowed depending on player choice, so the player could even choose four code pegs of the same colour or four blanks. In the instance that blanks are not elected to be a part of the game, the codebreaker may not use blanks in order to establish the final code. The chosen pattern is placed in the four holes covered by the shield, visible to the codemaker but not to the codebreaker. The codebreaker tries to guess the pattern, in both order and colour, within eight to twelve turns. Each guess is made by placing a row of code pegs on the decoding board. Once placed, the codemaker provides feedback by placing from zero to four key pegs in the small holes of the row with the guess. A black key peg is placed for each code peg from the guess which is correct in both colour and position. A white key peg indicates the existence of a correct colour code peg placed in the wrong position. If there are duplicate colours in the guess, they cannot all be awarded a key peg unless they correspond to the same number of duplicate colours in the hidden code. For example, if the hidden code is white-white-black-black and the player guesses white-white-white-black, the codemaker will award two black key pegs for the two correct whites, nothing for the third white as there is not a third white in the code, and a black key peg for the black. No indication is given of the fact that the code also includes a second black. Once feedback is provided, another guess is made; guesses and feedback continue to alternate until either the codebreaker guesses correctly, or twelve (or ten, or eight) incorrect guesses are made. If the code is not guessed correctly within 12 attempts then the code is revealed. 2.2 The Board Game "Mastermind44" Mastermind44 is a variation of the original Mastermind for 4 players: https://boardgamegeek.com/boardgame/12467/mastermind44 The difference between the two versions of the game are in the length of the code, how the code is created, how feedback is provided, and the number of attempts for each player: . . . . 2.3 Adaptation for Implementation: For the implementation we will make some adaptations: There is always only one game played. Both versions, the Original and Mastermind44 must be supported by the The code consists of 5 coloured pegs. There are five black code counters that contain the numbers 1 to 5. They indicate the position of the code. There are white code counters that contain a colour. There are 5 white code counters for each colour. They will be used to select the colour of a position in the code. The code counters are placed upside down on the table so the number and the colours cannot be seen. The code is created by the four players: Each player picks a black (with a number) and a white (with a colour) code counter and secretly places them with the colour and number facing to them. One black code counter will remain on the table. This indicates a blank on the position in the code as indicated by that counter. One player makes a guess and then that player and the other players provide feedback with a black or white key peg (or nothing) depending on their secret black and white code counter. (Note, the player who makes a guess may put the correct coloured code peg in the correct position according to his/her secret black and white code counter. He must indicate this by a key peg in the feedback). Then the next player clockwise makes a guess and receives feedback from everyone else. Each player has 5 attempts. The first player who receives four black key pegs wins. If each player guesses 5 times and no player wins then the code is revealed. implementation. No blanks are allowed for the Original Mastermind and there will be one blank in the code for Mastermind44. The Original version will use a code consisting of 4 pegs. The Mastermind44 version will use a code consisting of 5 pegs. The Original Mastermind version will allow 12 attempts and the Mastermind44 version will allow 5 attempts for each player. The computer will always provide feedback for each guess automatically on the screen. No human input is required. Each version will allow two modes: (1) With or (2) without computer support. Computer support means that the secret code is generated automatically at the start of a game. In case of the Original Mastermind version, this means that it becomes a single player game. In this assignment, you will design and implement a text-based Mastermind game that fulfils the specification above.Text-based does not mean ASCII art but instead will be driven by a text-based menu interface. The aim of the assignment is to allow you to practise creating an object-oriented design and implementing it in Python using features such as class inheritance, polymorphism, and composition. The focus of the assignment is on identifying classes and applying appropriate relationships between the classes. The game should be designed in such a way that code is reused and can be extended easily. In this first part of the assignment you will need to develop a class design using UML class diagrams in UMLet based on the requirements above and in the remainder of this specification. The UML class diagram MUST include all necessary classes, public, protected, and private attributes and methods, and all relationships between classes. A brief example of how the game will be played is provided below. The remainder of the section describes the requirements of the game in more detail. Note: the following conventions will be used when illustrating the example output below: A'>' at the beginning of a line indicates the command line prompt. Abold orange text indicates input entered by the user User input surrounded by square brackets '[...]' indicates a specific key press hitting [Enter] after other input is implied Inside Visual Studio Code: m Mastermind () m.play() Welcome to Mastermind! Developed by Georg Grossmann COMP 1046 Object-Oriented Programming Select which game you want to play: (A) Original Mastermind for 2 Players. (B) Original Mastermind for 1 Player (C) Mastermind44 for 4 Players (D) Mastermind44 for 4 Players with Computer Support: *Press A, B, C, or D to continue+ > [a] What would you like to do? Welcome Tom Turbo, you need to create a code that consists of four pegs. Eeach pag can be of the colour (R)ed, B(L)ue, (G) reen, (Y) ellow, (W) hite, or (8) lack. Specify the code by specifying four characters where each character indicates a colour as above. For example, WWRG represents the code White-White-Red-Green. You need to enter the code twice. No character is shown on the screen so Supermind cannot see it. Enter the code now: >BYYG Enter the same code again: >BYYG The code was stored. Welcome Supermind. You can now start to play by guessing the code. Enter a guess by providing four characters and press Enter. Attempt #1: >ZBVVD This attempt is incorrect. You must provide exactly four characters and they can only be, R, L, G, Y, W or B. >WWWW Feedback on Attempt #1: Nothing. Attempt #2: >BGRY Feedback on Attempt #2: BWN Attempt #3: >BGWB Feedback on Attempt #3: BW Attempt #4: >BYGB Feedback on Attempt #4:B B W Attempt #5: >BYBG Feedback on Attempt #5: B BB Attempt #6: > BYYG Feedback on Attempt #6: B B B B Congratulations! You broke the code in 6 attempts. What would you like to do? (p) lay the game again (q) uit > [q] Goodbye! The description that follows is a high-level view of the requirements that is enough to perform the initial design. More detailed instructions will accompany the specification for Part 2 of this Assignment, which will allow you to implement the game's functionality. 3. Work Plan To complete the first part of this assignment, you will need to perform the following steps: 1. Read the assignment specification carefully. 2. Review the relationships between classes in a UML class diagram: inheritance, association, aggregation, and composition. Identify which classes are necessary to capture the requirements. Identify attributes and methods of those classes. Specify public, private or protected for them as well as parameter names of methods, data types for attributes and data types for return values of methods. 5. Identify relationships between classes and add cardinalities where applicable, and add a label to the relationship. 6. Revisit all classes and see if you can use inheritance to minimize duplication of code. If you have an abstract class, then set its name in italic. 7. 8. You can add annotations to classes if it helps you later with the implementation (e.g., responsibilities of classes). 3. 4. Identifying all methods and attributes does not have to be complete or 100% correct at this point in time. It will give you the opportunity to think about the structure and flow of the application before starting the implementation. You can revise it later as you progress through the implementation, for example, you may realise you are missing some arguments to a member function or missing an entire function. The marking of this aspect will focus on the appropriate classes and relationships, separation of concerns, and good naming. After completing the design, generate a PNG and copy it into a Word document or generate a PDF version from the diagram and submit it to Moodle.
Step by Step Solution
3.48 Rating (155 Votes )
There are 3 Steps involved in it
Certainly it seems youre looking for guidance on designing a textbased Mastermind game using objecto... View full answer
Get step-by-step solutions from verified subject matter experts
