Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

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 Jul 04, 2021

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

Expert Solution

PFA

Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment