Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 3 Allow the player to choose a game level. If the input is invalid, allow data entry to be repeated. The valid game level
Question 3 Allow the player to choose a game level. If the input is invalid, allow data entry to be repeated. The valid game level is either 1 or 2. Develop an NxN memory card game and allow 2-4 players to play. On the face of cach card is a single letter, A-Z. The cards are shuffled and randomly placed face down in N-column and N-row grid. If the game level is 1, do not prompt for grid size. If the game level is 2, the players choose a grid size. If the input is invalid, allow data entry to be repeated. The valid grid size is between 2 and 7. Players take turn to pick two cards at each turn. Whenever a player picks 2 cards with matching letters, the cards are placed face up, and the player carns one point. The player gets to pick another pair repeatedly until the letters do not match or there are no more cards to pick. The game can be placed at 2 levels Level 1 N is 4, resulting in a 4x4 grid. Letters are randomly chosen and assigned to either 2 cards or 4 cards, repeatedly until 16 cards have been assigned letters. The application generates the cards according to the grid size (4x4 for level 1) and the constraints as specified for the game level, and the cards are shuffled. (Il marks) The application displays the cards face down and matched cards are displayed face up. Display NIL in the last grid position when N is odd (for level 2). (9 marks) At the start of each game, display a cheat sheet to help you test your program. The players take turn to pick until there are no more cards to pick (for both levels) or when the last two remaining cards do not match (for level 2 only). Level 2 N is an integer between 2 to 7. If the number of cells in the grid is odd, the last grid position is left empty and is marked NIL so only an even number of cards will be used in each game. For example, when N is 3.5 or 7. there are 8, 24 or 48 cards respectively. Letters are randomly chosen and assigned to either only I card or 2 cards. The letters on cards may come in pairs (50% chance) or there can be exactly 2 letters without a match (50% chance). Implement the memory card game. Your collections can be ONLY of these types: un- nested lists, dict or str collections. Display the score of a player when it is the player's turn to pick two cards. To pick a card, the player specifies the row and column numbers. Validate the row and column numbers, e.g., not NIL (for level 2 only), not a card that is already placed face up (for both levels), not outside grid boundary (for both levels) and the two cards picked are different cards. Display the updated score if the picked cards match (13 marks) When the game ends, display the players with the most pairs of cards matched, in alphabetical order of names of players that tie. Then prompt whether the players wish to play a new game. If so, allow the players to choose a grid size and the Note: The implementation of level 2 game play is worth 14 marks. You may implement level 1 first and then build level 2 on top of the implementation for level 1. game level. (3 marks) . Start the application by getting the names of the players. There should be 2 to 4 players with no repeating names. The same set of players will play one or more memory games until the application ends. Before cach new game commences, the application randomly orders the players, and this will be the order that the players take their turn. (4 marks) Example run Enter player name or CENTER) to exit (min 2, max 4 players): Minimum 2 players. Currently, a player Enter player same or CENTER to exit (min 2, max 4 players): ben Enter player name or
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started