“Morra” is a hand game usually played for entertainment or to settle a disagreement. The game has many variations and can be played by two or more players.
In this variation of the game, one player is going to be the “Odds” player and the other player is the “Evens” player. In each round of the game, the players will simultaneously hold out between 1 and 10 fingers. The winner of the round is decided based on the sum of fingers shown by both players, namely if the sum is an even number then the “Evens” player wins, otherwise if the sum is an odd number then the “Odds” player wins. The winner of the round receives two points. In addition, the player whose number of fingers is closer to the sum, receives one extra point. The winner of the game is the first player who accumulates six points.
Develop an application to allow a user to play repeatedly the game “Morra Odds and Evens” with a computer. At the beginning of each game the user will be prompted to choose whether he/she would like to be the “Odds” or “Even” player. In each round of the game the user must decide the number of fingers to show (i.e. between 1 and 10). Similarly, in each round of the game the computer will randomly pick one number between 1 and 10. In each round, the game displays the computer’s choice. After each round the game displays the number of points each player has, and whether the user or the computer won the round.
A game finishes when one of the players accumulates 6 points. At the end of a game, the game displays who the winner is, and a history of the numbers of fingers shown by both the user and the computer per round. Once a game has finished the application asks the player if he/she would like to play another game. At the end of all games, display a history of games played. The history shows for each game the number of rounds won and lost by the human player, and how many even and odd numbers have been chosen by each player, and the extra points received by the player per game. All the history elements of the game should be coded using arrays.
TBC