In this game, each of the four players has a tree and a basket. They are trying to pick the 10 cherries from their tree and place them in their basket. To do this, each player in turn spins a spinner. If the spinner lands on a number, 1-4, the player takes that many cherries from their tree and places them in the basket.
The spinner can also land on a hazard. There are three hazards, a bird that puts two cherries back on the tree, a dog that does the same, and a spilled basket. If the player lands on the spilled basket, all of their cherries magically fly back onto the tree and they must start again.
Starting with the first player, the players each take turns spinning the the spinner and placing cherries in their basket. The first one to reach 10 cherries in the basket cries "Hi Ho Cherry-O!" and wins the game.
Your program should ask, for each player, if that player is a human or a computer. If the player is a human, ask for their name. If they are a computer, assign them a name. All players baskets should be initialized to hold 0 cherries and then the game begins.
For each round, print a report similar to the following:
Rachel, It is your turn. Press Enter to spin You picked 2 cherries. You now have 2 cherries. Player 2 You spilled your basket. You now have 0 cherries. Player 3 You picked 1 cherry. You now have 1 cherries. Player 4 You picked 4 cherries. You now have 4 cherries. Player 1, Rachel, (2) is a human. * * O O O O O O O O Player 2, Bettie, (0) is a computer. O O O O O O O O O O Player 3, Deltie, (1) is a computer. * O O O O O O O O O Player 4, Gammie, (4) is a computer. * * * * O O O O O O Press ENTER to continue:As soon as a player wins, the game should end, and report the winner and the number of turns it took to win.
You will need to use the rand and srand functions from the cstdlib library. Please see random.C for details.
You will be able to complete this program without the use of arrays, structures, or objects. If you know how to use these constructs, you may, but it is not a requirement.
Please make sure you follow good programming practices. Use procedures, functions, constants, good programming style, and good documentation standards.
When you are finished, email a copy of the source code for this program to dbennett@edinboro.edu. Make sure that this program compiles on the departmental unix machines.
This program is due on Wednesday September 12 at 11:59 pm.