% a.out This program plays the game of Go Fish Would you like to see instructions? please enter yes or no: yes **************************************************************** The game of Go Fish can be played with 2 or more players After entering the number of players and each players information, the game proceeds as follows: (1) Each player is delt 5 cards (note: any time a player is delt cards, if there are any pairs added to his/her hand, they are laid down on the table. As a result, a player delt 5 new cards may only have 3 or 1 cards in his/her hand due to being delt some matching pairs). (2) Each player takes a turns (in order), until the game ends The current player keeps his/her turn as long as he/she finds pairs. Otherwise, play moves to the next player. (a) if the player is out of cards, 5 more are delt to him/her (b) the current player asks some other player if he/she has a card matching one in the player's hand (c) if the asked player has the card, he/she gives it to the current player, the current player lays the pair down and gets to keep his/her turn (goes to step 2a) (d) if the asked player doesn't have a card, then he/she tells the current player to 'GO FISH' and the current player draws one card from the deck (if the drawn card matches a card in the player's hand, the pair is laid down on the table). The current player's turn is over, and play moves to the next player who starts at step 2a (3) If at any time a player runs out of cards in his her hand, he/ she draws up to 5 new cards from the deck and continues playing (4) Play ends when the first player runs out of cards in his/her hand, are no more cards in the deck to draw (5) The winner of the game is the player with the most pairs **************************************************************** How many computer players would you like to play with? enter an value between 1 and 3: 3 Enter your name (you are player number 0): Tia Enter a name for player 1): Mookie Enter a name for player 2): Cookie Enter a name for player 3): Rookie ############### Player 0's turn ############### ****** PAIRS ON THE TABLE ***** Player 0, Tia, has 3 cards in his/her hand & 1 pairs: 9 of Diamonds 9 of Spades Player 1, Mookie, has 3 cards in his/her hand & 1 pairs: 2 of Hearts 2 of Spades Player 2, Cookie, has 5 cards in his/her hand & 0 pairs: Player 3, Rookie, has 3 cards in his/her hand & 1 pairs: 10 of Spades 10 of Diamonds ************************************** Tia, your hand is: 3 of Diamonds 4 of Diamonds 5 of Diamonds From which player do you want a card? enter an value between 1 and 3: 1 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 13 13 is not a valid choice you must pick a card that is in your hand 3 of Diamonds 4 of Diamonds 5 of Diamonds try again.... Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 3 Tia chooses player 1, Mookie, to ask for a 3: Player 1 had the card asked for! Tia gets another turn!!! Tia, your hand is: 4 of Diamonds 5 of Diamonds From which player do you want a card? enter an value between 1 and 3: 7 hey, 7 isn't betwen 1 and 3 ...try again enter an value between 1 and 3: 2 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 4 Tia chooses player 2, Cookie, to ask for a 4: Player 2 doesn't have that card, GO FISH!!! ############### Player 1's turn ############### Mookie chooses player 0, Tia, to ask for a 8: Player 0 doesn't have that card, GO FISH!!! ############### Player 2's turn ############### Cookie chooses player 3, Rookie, to ask for a 5: Player 3 doesn't have that card, GO FISH!!! ############### Player 3's turn ############### Rookie chooses player 0, Tia, to ask for a 1: Player 0 doesn't have that card, GO FISH!!! ############### Player 0's turn ############### ****** PAIRS ON THE TABLE ***** Player 0, Tia, has 3 cards in his/her hand & 2 pairs: 3 of Hearts 3 of Diamonds 9 of Diamonds 9 of Spades Player 1, Mookie, has 3 cards in his/her hand & 1 pairs: 2 of Hearts 2 of Spades Player 2, Cookie, has 6 cards in his/her hand & 0 pairs: Player 3, Rookie, has 4 cards in his/her hand & 1 pairs: 10 of Spades 10 of Diamonds ************************************** Tia, your hand is: 4 of Diamonds 5 of Diamonds 9 of Hearts From which player do you want a card? enter an value between 1 and 3: 2 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 5 Tia chooses player 2, Cookie, to ask for a 5: Player 2 had the card asked for! Tia gets another turn!!! Tia, your hand is: 4 of Diamonds 9 of Hearts From which player do you want a card? enter an value between 1 and 3: 3 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 9 Tia chooses player 3, Rookie, to ask for a 9: Player 3 doesn't have that card, GO FISH!!! ############### Player 1's turn ############### Mookie chooses player 0, Tia, to ask for a 3: Player 0 doesn't have that card, GO FISH!!! ############### Player 2's turn ############### Cookie chooses player 3, Rookie, to ask for a 13: Player 3 had the card asked for! Cookie gets another turn!!! Cookie chooses player 3, Rookie, to ask for a 8: Player 3 had the card asked for! Cookie gets another turn!!! Cookie chooses player 1, Mookie, to ask for a 12: Player 1 doesn't have that card, GO FISH!!! ############### Player 3's turn ############### Rookie chooses player 2, Cookie, to ask for a 4: Player 2 had the card asked for! Rookie gets another turn!!! Rookie chooses player 2, Cookie, to ask for a 1: Player 2 had the card asked for! Rookie gets another turn!!! oops, player 3 is out of cards, draw more first Rookie chooses player 1, Mookie, to ask for a 13: Player 1 doesn't have that card, GO FISH!!! ############### Player 0's turn ############### ****** PAIRS ON THE TABLE ***** Player 0, Tia, has 3 cards in his/her hand & 3 pairs: 3 of Hearts 3 of Diamonds 5 of Clubs 5 of Diamonds 9 of Diamonds 9 of Spades Player 1, Mookie, has 4 cards in his/her hand & 1 pairs: 2 of Hearts 2 of Spades Player 2, Cookie, has 2 cards in his/her hand & 2 pairs: 8 of Diamonds 8 of Clubs 13 of Clubs 13 of Hearts Player 3, Rookie, has 4 cards in his/her hand & 4 pairs: 1 of Clubs 1 of Diamonds 4 of Clubs 4 of Hearts 6 of Diamonds 6 of Spades 10 of Spades 10 of Diamonds ************************************** Tia, your hand is: 4 of Diamonds 7 of Hearts 9 of Hearts From which player do you want a card? enter an value between 1 and 3: 1 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 4 Tia chooses player 1, Mookie, to ask for a 4: Player 1 doesn't have that card, GO FISH!!! ############### Player 1's turn ############### Mookie chooses player 3, Rookie, to ask for a 8: Player 3 had the card asked for! Mookie gets another turn!!! Mookie chooses player 2, Cookie, to ask for a 7: Player 2 doesn't have that card, GO FISH!!! ############### Player 2's turn ############### Cookie chooses player 1, Mookie, to ask for a 12: Player 1 doesn't have that card, GO FISH!!! ############### Player 3's turn ############### Rookie chooses player 0, Tia, to ask for a 9: Player 0 had the card asked for! Rookie gets another turn!!! Rookie chooses player 1, Mookie, to ask for a 3: Player 1 had the card asked for! Rookie gets another turn!!! Rookie chooses player 1, Mookie, to ask for a 13: Player 1 doesn't have that card, GO FISH!!! ############### Player 0's turn ############### ****** PAIRS ON THE TABLE ***** Player 0, Tia, has 1 cards in his/her hand & 4 pairs: 3 of Hearts 3 of Diamonds 4 of Spades 4 of Diamonds 5 of Clubs 5 of Diamonds 9 of Diamonds 9 of Spades Player 1, Mookie, has 1 cards in his/her hand & 3 pairs: 2 of Hearts 2 of Spades 7 of Diamonds 7 of Clubs 8 of Hearts 8 of Spades Player 2, Cookie, has 3 cards in his/her hand & 2 pairs: 8 of Diamonds 8 of Clubs 13 of Clubs 13 of Hearts Player 3, Rookie, has 0 cards in his/her hand & 7 pairs: 1 of Clubs 1 of Diamonds 3 of Clubs 3 of Spades 4 of Clubs 4 of Hearts 6 of Diamonds 6 of Spades 9 of Hearts 9 of Clubs 10 of Spades 10 of Diamonds 13 of Spades 13 of Diamonds ************************************** Tia, your hand is: 7 of Hearts From which player do you want a card? enter an value between 1 and 3: 2 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 7 Tia chooses player 2, Cookie, to ask for a 7: Player 2 doesn't have that card, GO FISH!!! ############### Player 1's turn ############### Mookie chooses player 3, Rookie, to ask for a 10: Player 3 doesn't have that card, GO FISH!!! ############### Player 2's turn ############### Cookie chooses player 3, Rookie, to ask for a 11: Player 3 doesn't have that card, GO FISH!!! ############### Player 3's turn ############### oops, player 3 is out of cards, draw more first Rookie chooses player 1, Mookie, to ask for a 12: Player 1 doesn't have that card, GO FISH!!! ############### Player 0's turn ############### ****** PAIRS ON THE TABLE ***** Player 0, Tia, has 2 cards in his/her hand & 4 pairs: 3 of Hearts 3 of Diamonds 4 of Spades 4 of Diamonds 5 of Clubs 5 of Diamonds 9 of Diamonds 9 of Spades Player 1, Mookie, has 2 cards in his/her hand & 3 pairs: 2 of Hearts 2 of Spades 7 of Diamonds 7 of Clubs 8 of Hearts 8 of Spades Player 2, Cookie, has 2 cards in his/her hand & 3 pairs: 8 of Diamonds 8 of Clubs 11 of Diamonds 11 of Clubs 13 of Clubs 13 of Hearts Player 3, Rookie, has 6 cards in his/her hand & 7 pairs: 1 of Clubs 1 of Diamonds 3 of Clubs 3 of Spades 4 of Clubs 4 of Hearts 6 of Diamonds 6 of Spades 9 of Hearts 9 of Clubs 10 of Spades 10 of Diamonds 13 of Spades 13 of Diamonds ************************************** Tia, your hand is: 7 of Hearts 12 of Spades From which player do you want a card? enter an value between 1 and 3: 3 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 12 Tia chooses player 3, Rookie, to ask for a 12: Player 3 had the card asked for! Tia gets another turn!!! Tia, your hand is: 7 of Hearts From which player do you want a card? enter an value between 1 and 3: 2 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 7 Tia chooses player 2, Cookie, to ask for a 7: Player 2 doesn't have that card, GO FISH!!! ############### Player 1's turn ############### Mookie chooses player 2, Cookie, to ask for a 10: Player 2 doesn't have that card, GO FISH!!! ############### Player 2's turn ############### Cookie chooses player 1, Mookie, to ask for a 1: Player 1 doesn't have that card, GO FISH!!! ############### Player 3's turn ############### Rookie chooses player 0, Tia, to ask for a 11: Player 0 doesn't have that card, GO FISH!!! ############### Player 0's turn ############### ****** PAIRS ON THE TABLE ***** Player 0, Tia, has 2 cards in his/her hand & 5 pairs: 3 of Hearts 3 of Diamonds 4 of Spades 4 of Diamonds 5 of Clubs 5 of Diamonds 9 of Diamonds 9 of Spades 12 of Clubs 12 of Spades Player 1, Mookie, has 3 cards in his/her hand & 3 pairs: 2 of Hearts 2 of Spades 7 of Diamonds 7 of Clubs 8 of Hearts 8 of Spades Player 2, Cookie, has 3 cards in his/her hand & 3 pairs: 8 of Diamonds 8 of Clubs 11 of Diamonds 11 of Clubs 13 of Clubs 13 of Hearts Player 3, Rookie, has 4 cards in his/her hand & 8 pairs: 1 of Clubs 1 of Diamonds 2 of Clubs 2 of Diamonds 3 of Clubs 3 of Spades 4 of Clubs 4 of Hearts 6 of Diamonds 6 of Spades 9 of Hearts 9 of Clubs 10 of Spades 10 of Diamonds 13 of Spades 13 of Diamonds ************************************** Tia, your hand is: 6 of Hearts 7 of Hearts From which player do you want a card? enter an value between 1 and 3: 1 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 6 Tia chooses player 1, Mookie, to ask for a 6: Player 1 doesn't have that card, GO FISH!!! ############### Player 1's turn ############### Mookie chooses player 2, Cookie, to ask for a 10: Player 2 doesn't have that card, GO FISH!!! ############### Player 2's turn ############### Cookie chooses player 1, Mookie, to ask for a 12: Player 1 had the card asked for! Cookie gets another turn!!! Cookie chooses player 1, Mookie, to ask for a 1: Player 1 doesn't have that card, GO FISH!!! ############### Player 3's turn ############### Rookie chooses player 0, Tia, to ask for a 1: Player 0 doesn't have that card, GO FISH!!! ############### Player 0's turn ############### ****** PAIRS ON THE TABLE ***** Player 0, Tia, has 3 cards in his/her hand & 5 pairs: 3 of Hearts 3 of Diamonds 4 of Spades 4 of Diamonds 5 of Clubs 5 of Diamonds 9 of Diamonds 9 of Spades 12 of Clubs 12 of Spades Player 1, Mookie, has 1 cards in his/her hand & 4 pairs: 2 of Hearts 2 of Spades 7 of Diamonds 7 of Clubs 8 of Hearts 8 of Spades 10 of Hearts 10 of Clubs Player 2, Cookie, has 2 cards in his/her hand & 4 pairs: 8 of Diamonds 8 of Clubs 11 of Diamonds 11 of Clubs 12 of Hearts 12 of Diamonds 13 of Clubs 13 of Hearts Player 3, Rookie, has 4 cards in his/her hand & 8 pairs: 1 of Clubs 1 of Diamonds 2 of Clubs 2 of Diamonds 3 of Clubs 3 of Spades 4 of Clubs 4 of Hearts 6 of Diamonds 6 of Spades 9 of Hearts 9 of Clubs 10 of Spades 10 of Diamonds 13 of Spades 13 of Diamonds ************************************** Tia, your hand is: 6 of Hearts 7 of Hearts 11 of Hearts From which player do you want a card? enter an value between 1 and 3: 3 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 11 Tia chooses player 3, Rookie, to ask for a 11: Player 3 had the card asked for! Tia gets another turn!!! Tia, your hand is: 6 of Hearts 7 of Hearts From which player do you want a card? enter an value between 1 and 3: 2 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 7 Tia chooses player 2, Cookie, to ask for a 7: Player 2 doesn't have that card, GO FISH!!! ############### Player 1's turn ############### Mookie chooses player 2, Cookie, to ask for a 5: Player 2 doesn't have that card, GO FISH!!! ############### Player 2's turn ############### Cookie chooses player 0, Tia, to ask for a 6: Player 0 had the card asked for! Cookie gets another turn!!! Cookie chooses player 0, Tia, to ask for a 1: Player 0 doesn't have that card, GO FISH!!! ############### Player 3's turn ############### Rookie chooses player 1, Mookie, to ask for a 7: Player 1 doesn't have that card, GO FISH!!! ############### Player 0's turn ############### ****** PAIRS ON THE TABLE ***** Player 0, Tia, has 1 cards in his/her hand & 6 pairs: 3 of Hearts 3 of Diamonds 4 of Spades 4 of Diamonds 5 of Clubs 5 of Diamonds 9 of Diamonds 9 of Spades 11 of Spades 11 of Hearts 12 of Clubs 12 of Spades Player 1, Mookie, has 1 cards in his/her hand & 4 pairs: 2 of Hearts 2 of Spades 7 of Diamonds 7 of Clubs 8 of Hearts 8 of Spades 10 of Hearts 10 of Clubs Player 2, Cookie, has 1 cards in his/her hand & 5 pairs: 6 of Hearts 6 of Clubs 8 of Diamonds 8 of Clubs 11 of Diamonds 11 of Clubs 12 of Hearts 12 of Diamonds 13 of Clubs 13 of Hearts Player 3, Rookie, has 3 cards in his/her hand & 8 pairs: 1 of Clubs 1 of Diamonds 2 of Clubs 2 of Diamonds 3 of Clubs 3 of Spades 4 of Clubs 4 of Hearts 6 of Diamonds 6 of Spades 9 of Hearts 9 of Clubs 10 of Spades 10 of Diamonds 13 of Spades 13 of Diamonds ************************************** Tia, your hand is: 7 of Hearts From which player do you want a card? enter an value between 1 and 3: 2 Which rank card of card do want to ask for (1-Ace, 2-10, 11-Jack, 12-Queen, 13-King)? enter an value between 1 and 13: 7 Tia chooses player 2, Cookie, to ask for a 7: Player 2 doesn't have that card, GO FISH!!! ############### Player 1's turn ############### Mookie chooses player 3, Rookie, to ask for a 5: Player 3 had the card asked for! Mookie gets another turn!!! oops, player 1 is out of cards, draw more first no more cards left. Game is over! ****** PAIRS ON THE TABLE ***** Player 0, Tia, has 1 cards in his/her hand & 6 pairs: 3 of Hearts 3 of Diamonds 4 of Spades 4 of Diamonds 5 of Clubs 5 of Diamonds 9 of Diamonds 9 of Spades 11 of Spades 11 of Hearts 12 of Clubs 12 of Spades Player 1, Mookie, has 0 cards in his/her hand & 5 pairs: 2 of Hearts 2 of Spades 5 of Hearts 5 of Spades 7 of Diamonds 7 of Clubs 8 of Hearts 8 of Spades 10 of Hearts 10 of Clubs Player 2, Cookie, has 1 cards in his/her hand & 5 pairs: 6 of Hearts 6 of Clubs 8 of Diamonds 8 of Clubs 11 of Diamonds 11 of Clubs 12 of Hearts 12 of Diamonds 13 of Clubs 13 of Hearts Player 3, Rookie, has 2 cards in his/her hand & 8 pairs: 1 of Clubs 1 of Diamonds 2 of Clubs 2 of Diamonds 3 of Clubs 3 of Spades 4 of Clubs 4 of Hearts 6 of Diamonds 6 of Spades 9 of Hearts 9 of Clubs 10 of Spades 10 of Diamonds 13 of Spades 13 of Diamonds ************************************** Player 3, Rookie, won with 8 pairs