Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / You should use the basic programming concepts that you have been taught to implement the game “Matching pennies”, played by a human and a computer player, taking turns

You should use the basic programming concepts that you have been taught to implement the game “Matching pennies”, played by a human and a computer player, taking turns

Computer Science

You should use the basic programming concepts that you have been taught to implement the game “Matching pennies”, played by a human and a computer player, taking turns. It is a game played between two players, Even and Odd. Each player has a penny and must secretly turn the penny to heads or tails. The players then reveal their choices simultaneously. If the pennies match (both heads or both tails), then Even keeps both pennies, so wins one from Odd (+1 for Even, -1 for Odd). If the pennies do not match (one heads and one tails) Odd keeps both pennies, so receives one from Even (-1 for Even, +1 for Odd) Running the program should first ask the user for the number of starting pennies for each player, for example 5 or 20, and if the human player is “Even” or “Odd”. For each round, the two players take turns: human player should be able choose “Heads” or “Tails” using a number for each (0 or 1). After the human player’s choice, the computer player should be able to choose one of the two options as well, using a random coin flip. You then must compare the choices and modify the number of pennies for each player accordingly. When one of the two players runs out of pennies, display who won each round and the final winner (Even or Odd). Use basic commands such as if, else if, for, do while, while, etc

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE