abhinand5 / dice-game

The PIG Dice Game Using JavaScript. Tap on the link to play. :point_right:

Home Page:https://abhinand5.github.io/dice-game/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Dice Game

The PIG Dice Game Using JavaScript. Click Here to play

Whether you are stuck in a waiting room, needing entertainment at a restaurant, or looking for a simple game while on vacation, Pig is the perfect way to pass the time with friends and family. And all you need is this web app that I built.

Pig is considered a jeopardy game, where you risk everything to see if you can win more. The numbers on the die (except for "1") each represent points that can accumulate—the winner is the first player to reach 100 points.

Rules of the Game:

On a turn, a player rolls the die repeatedly. The goal is to accumulate as many points as possible, adding up the numbers rolled on the die. However, if a player rolls a 1, the player's turn is over and any points they have accumulated during this turn are forfeited. Rolling a 1 doesn't wipe out your entire score, just the total earned during that particular roll.

A player can also choose to hold (stop rolling) if they do not want to take a chance of rolling a 1 and losing all of their points from this turn. If the player chooses to hold, all of the points rolled during that turn are added to his or her score.

When a player reaches a total of 100 or more points, the game ends and that player is the winner.

Scoring Examples

Here are two examples of how to keep score in Pig:

Example 1: Tim rolls a 3 and decides to continue rolling. He rolls seven more times, getting a 6, 6, 6, 4, 5, 6, and then 1. Because He rolled a 1, Tim's turn is over and he earns 0 points for this turn.

Example 2: Craig rolls a 6 and decides to continue.

He then chooses to roll four more times, getting a 3, 4, 2, and 6. He decides to hold (and not take a chance of getting a 1). Craig earns 21 points for this turn (6+3+4+2+6=21).

This way the play continues until a target is reached, in this game the target is set to a default of 100.

About

The PIG Dice Game Using JavaScript. Tap on the link to play. :point_right:

https://abhinand5.github.io/dice-game/


Languages

Language:JavaScript 41.9%Language:CSS 35.1%Language:HTML 23.0%