The Pig game is a two-player dice game that challenges players to be the first to reach a score of 100 points. Each turn, a player rolls a dice as many times as they wish, accumulating points with each roll. However, if a player rolls a one, they lose all the points they have accumulated during their turn and the other player gets a chance to roll. The game continues until one player reaches a score of 100 points, at which point they are declared the winner.
DEMO: https://jenniengi.github.io/pig-game/
- HTML
- CSS
- JavaScript
To play the Pig game, simply open the index.html file in your web browser. The game board will be displayed, along with buttons for rolling the dice, holding your score, and starting a new game.
- The first player starts by rolling the dice.
- If the player rolls a number from 2 to 6, the number is added to their current score. The player can choose to roll again to add more points to their score, or hold their current score and end their turn.
- If the player rolls a one, their current score is reset to zero and their turn is over. The other player then takes their turn.
- Play continues back and forth between the two players until one player reaches a score of 100 points or more.
- The first player to reach 100 points is declared the winner.
- The game is played with 2 dice.
- Each turn, a player can roll the dice as many times as they wish, accumulating points with each roll.
- If a player rolls a one, their current score is reset to zero and their turn is over.
- If a player chooses to hold their current score, the score is added to their total score and their turn is over.
- The first player to reach 100 points is declared the winner.
- Instructor-guided project
- Udemy course created by Jonus Schmedimann