Homework 1, Hi Ho Cherry-O Game Simulation

Short Description:

Write a program which simulates the game of Hi Ho Cherry-O

This assignment is worth 100 points.

Goals

When you finish this homework, you should:

Formal Description

Write a program to simulate the game of Hi Ho Cherry-O.

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 it 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 Bettie, A computer Player
You spilled your basket.   You now have 0 cherries.

Player 3 Deltie, A computer Player
You picked 1 cherry.     You now have 1 cherries.

Player 4 Gammie, A computer Player
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.

Discussion

Required Files

You should submit the following in a tar file: You should not submit

Submission

Please create a tar file containing the files described above. Email this file to danbennett360@gmail.com by class time of the due date.