/Pig-Game

This is a simple game with JavaScript

Primary LanguageJavaScript

Pig Game

The Pig game is a simple dice game played with two or more players.
The objective of the game is to score 100 points before your opponents, by rolling a single die to earn points.
The game has two players, playing in rounds.
In each turn, a player rolls a dice as many times as they wish, adding all roll results to a running total, but losing their gained score for the turn if they roll a 1.
The player can choose to 'Hold', which means that their round score gets added to their global score.
After that, it's the next player's turn. The first player to reach 100 points on the global score wins the game.

How to Play

Grab a single die and 2 or more players.
Determine who goes first. We suggest doing a roll-off to determine who goes first.
Each player rolls the die once, and the highest roll goes first, with play continuing clockwise.
If players tie on the highest roll, the process is repeated until a winner is determined.
On your turn, roll the die as many times as you wish, adding all roll results to a running total.
If you roll a 1, all your round score gets lost, and it becomes the next player's turn.
If you roll any other number, it gets added to your round score.
You can choose to 'Hold' your round score, which gets added to your global score.
The first player to reach 100 points on the global score wins the game.

Features

The game has two or more players.
Players can roll the dice as many times as they wish.
If a player rolls a 1, their round score gets lost, and it becomes the next player's turn.
Players can choose to 'Hold', which means that their round score gets added to their global score.
The first player to reach 100 points on the global score wins the game.
Code Structure The Pig game can be built using HTML, CSS, and JavaScript.
The main logic of the game lies in the JavaScript file, while the appearance and user interface are handled by the HTML and CSS files.
The game can be built using four types of files: HTML file, CSS file, JavaScript file, and images.

Example

Here's an example of how to play the Pig game:
Open the Pig game on a web browser.
Click the 'Roll Dice' button to roll the dice.
If you roll a 1, your round score gets lost, and it becomes the next player's turn.
If you roll any other number, it gets added to your round score.
You can choose to 'Hold' your round score, which gets added to your global score.
The first player to reach 100 points on the global score wins the game.

Future Improvements

Some potential enhancements or new features that could be added to the Pig game in the future include:
Adding sound effects to the game.
Allowing players to choose the number of points required to win the game.
Adding a leaderboard to display the overall best player.
Implementing two dice instead of one. (Already Done)
By following this documentation, you can create a Pig game that is easy to understand and play.