Pig (dice game)

About

This project uses JavaScript and lots and lots of DOM manipulation to update things like the scores of each round, the visuals showing whose turn it is, and making sure certain buttons become inactive when someone wins.

The rules of the game:
  • The game is played between two players.
  • When it's a player's turn they roll the dice.
  • They can roll the dice as many times as they wish to, and each result gets added to their 'round score'.
  • If they roll a '1', their round score is lost and it's the other player's turn.
  • If they decide to 'hold', their round score gets transferred to their total score and, as above, it's the other player's turn.
  • The winner is the first person to get to either the total entered, or more. If no total is entered, the default is 100 points.
Try it for yourself:
Click here

Code:
You can take a look at the code here.

Screenshots