Question: Write a c + + program as basic / simple as possible. Code conditions: The game displays two options: 1 - Two players ( user

Write a c++ program as basic/simple as possible. Code conditions:
The game displays two options:
1- Two players (user vs user)
2- Two players (PC vs user)
In the next step, the users must enter their names. Thus, the player's turn is displayed during the game run.
At the end of the game, display the name of the winner.
The first, user vs user, option allows two people to play the game.
Prompt the user to enter the total number of tokens (must be 5 otherwise prompt the user to try
again).
Distribute tokens to 5 piles randomly so that there is no empty pile at the beginning.
For example, let's say the user enters 15 tokens, the game might display the following:
A: 00
B: 0000
C: 000
D: 00000
E: O
Note her the pile is represented by a row but you can draw it vertically as you like.
Assume player1 selects two tokens from the second pile, she/he may enter B2 or B 2 then the game
shows
A: 00
B: 00
C: 000
D: O0OOO
E: O
The second option, PC vs user, option allows the user to play against your algorithm.
Instead of using only 5 heaps, prompt the user to enter the number of heaps (or columns).
The number of heaps (piles) can range from 2 to 10.
Distribute tokens to all piles based on the following function:
f(i)=|??10e??-(i-5)210.89|
For example, the first pile has two tokens, f(1)=[2.301]=2, the second pile has four tokens,
f(2)=[4.376]=4, and so on.
Develop an algorithm enabling your game to play and win against any user.
Write a c + + program as basic / simple as

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!