Game of Pig

  • You are going to make a computer player vs human player game using two dice
  • On each turn, the player rolls a pair of dice and adds up his or her points.
  • Whoever reaches 100 points first, wins.  You are allowed to go over.
  • If a player rolls a 1, he or she loses all points for that round and the dice go to the other player
  • If a player rolls two 1s in one turn, the player loses all points earned so far in the game and loses control of the dice
  • The player may voluntarily turn over the dice after each roll. So the player must decide to either roll again (be a pig) and risk losing points, or give up the dice, possibly letting the other player win.
  • Setup the computer player so that it always gives up the dice after getting 20 or more point in a round.