Question: please follow the exact!! testing format Game description (simplified): Old Maid is a game that requires 51 cards, that is to say the traditional 52





please follow the exact!! testing formatGame description (simplified): Old Maid is a game that requires 51 cards, that is to say the traditional 52 cards minus the jack of clubs card. Each player takes a card from his left neighbour, without seeing the card. Then all pairs are discarded. A pair is two cards with the same value. You have to get rid of all your cards to win. The player who ends up with the Old Maid player, that is to say the jack of clubs, will loose. To simplify the game even more, we will have only two players: the computer (i.e., your program) and a user (you). We will call the computer Robot and the user Human. Robot will give the cards for each game. It is not allowed to modify the functions that are already completed, nor the main program. You can only change functions that are not completed. You can add other functions if you wish. The functions make deck, wait for player and shuffle deck are already fully coded for you. You must complete the other functions: deal cards, remove pairs, display cards, get valid input, and play. These functions must respect the descriptions for the data type and the result type (the "docstring" comments). Do not modify their header (name and number of parameters). Most of your code should go into the play function, which should call the other functions (i.e., deal cards, remove pairs, display_cards, and get valid_input). For the get valid input function, we assume that Human will enter an integer value, but check in the function if it is a valid integer (between 1 and the number of cards). The function should ask Human which card he wants, among the Robot cards that Human cannot see. When Robot takes a Human card, the card must be chosen randomly (you can use the random function). If Human asks, for example the 3rd card, it means the position/index element 2 among Robot's cards (because it is a list). Suggestions: - Study the parts of the code already completed to understand them. - Think about the parts of the game that remain to be completed. For example, the game must show to Human these cards, be able to ask Human which card he wants, remove the card pairs for Robot and for Human, etc. - Complete the functions one at a time, to avoid too many errors at the same time. You can test each function before completing the others, in the Python interpreter. For example, you can test the remove pairs function with test cases like this: (the order of elements in the result could be different): remove pairs ([10', '2', '50', '6', '9', 'A0', '100']): [2,50,64,94,A0] - The game takes tums between Robot and Human. Think about how you can represent each round (who to play). One possibility is to use a variable that is zero when it is Robot's tum and 1 when it is Human's turn. You will also need to identify when the game ends and who has won. \# Testing Example 1: Game 1 Hello. My name is Robot and I'm dealing the cards. Your hand is: Don't worry, I can't see your cards or their order. Now discard all pairs from your hand. Ill do it too. Press Enter to continue. Your turn. Your hand is: 7206084094 I have 7 cards. If 1 is the position of my first card and 7 is the position of my last card, which one of my cards do you want? Please enter an integer from 1 to 7:5 You asked my 5 th card. Here it is. It's a 7 With 7 added, your hand is: 70206084097 After discarding all pairs and shuffling the cards, your hand is: 20609840 Press Enter to continue. My turn. I took your 5 th card. Press Enter to continue. Your turn. Your hand is: 20609484 I have 5 cards. If 1 is the position of my first card and 5 is the position of my last card, which one of my cards do you want? Please enter an integer from 1 to 5:3 You asked my 3rd card. Here it is. It's a 80 With 80 added, your hand is: 20609880 After discarding all pairs and shuffling the cards, your hand is: 60920 Press Enter to continue. My turn. I took your 1 st card. Press Enter to continue. Your tum. Your hand is: 9=20 I have 3 cards. If 1 is the position of my first card and 3 is the position of my last card, which one of my cards do you want? Please enter an integer from 1 to 3:2 You asked my 2nd card. Here it is. It's a 94 With 9 added, your hand is: 9+209 A After discarding all pairs and shuffling the cards, your hand is: 20 Press Enter to continue. My turn. 1 took your 1 st card. Press Enter to continue. 1 do not have any more cards. Congratulations! You, Human, have won. Hello. My nume is Robot and Im dealing the cards. Your hand is: K04+1005010+3010040608+2+7024K9+643+4+90Q+KO80Q0208090 Don't worry, I can't see your cards or their order. Now discard all paip from your hand. FIl do it too. Press Enter to contimic. Your turn. Your hand is: 4+28K+70.50910 Thave 9 cards. If 1 is the position of my first card and 9 is the position of my last eard, which one of my cards do you want? Please enter an integer from I to 9:2 You asked my 2 nd card. Here it is. It's a 20 With 20 added, your hand is: 428K705091020 After discarding all pairs and shuffing the cards, your hand is: 50810K9704 Press Enter to continue. My turn. I took your 5 th card. Press Enter to continue. Your turn. Your hand is. 508+10+K704 1 have 7 cards. If I is the position of my first card and 7 is the position of my last card, which one of my cands do you want? Please enter an integer from 1 to 7:6 You asked my 6 th card. Here it is: It's a 40 With 40 added, your hand is: 50810K70440 After discarding all pairs and shuffling the cards, your hand is: Affer discarding all pain and shurfling the carts, your hand is: 70BK1050 Press Enta to continue. My tum. I I took your Ird card Press Enter to continue. Your fum Your hand is: 70810+50 I have 5 cards. If I is the povition of my first card and S is the position of my last card, which one of my cards do you want? Please enter an integer from I to 5:3 You asked my 3 ru card. Here it is. In a 5 With 5 s added, your hand is: 708+105054 After discarding all pain and shafting the candw, your hand is: 8+10e70 Press Enter to contigue. My tum. 1 took your 3nd card: Press Enter tj continue. Your turn. Your hand is: 810 I have 3 cards. If 1 is the position of my first card and 3 is the position of my last card, which one of my cards do you want? Please enter an integer from 1 to 3:2 You asked my 2 nd card. Here it is. It's a Jo With Jo added, your hand is: 81050 After discarding all pairs and shuffling the cards, your hand is: 81010 Press Enter to continue. My rum. I took your 3 rd card. Press Enter to continue. Your turn. Your hand is: 8J0 I have 1 cards. If I is the position of my first card and 1 is the position of my last card, which one of my cards do you want? Please enter an integer from 1 to 1:1 You asked my I st card. Here it is. It's a 8 e With 8 added, your hand is: 84J08 After discarding all pairs and shuffling the cards, your hand is: Jo Press Enter to continue. I do not have any more cards. You lost! I, Robot, won
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
