Skip to content

A simple JavaScript two-player dice game where the goal is to reach 100 points first. Players roll a die and accumulate points, but risk losing them if they roll a 1.

License

Notifications You must be signed in to change notification settings

TSWanniarachchi/pig-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pig Game

Description

Welcome to Pig Game! This project is a simple dice game where two players compete to reach 100 points first. Players take turns rolling a single die as many times as they wish, accumulating points for each roll. However, if a player rolls a 1, they lose all points accumulated during their turn, and the turn passes to the other player. The first player to reach 100 points wins the game.

How to Play

  1. Start the Game: Player 1 begins the game.
  2. Roll the Die: On your turn, roll the die by clicking the "Roll Dice" button.
  3. Accumulate Points: Each roll adds points to your current turn's score unless you roll a 1.
  4. Hold or Continue:
    • Hold: Click the "Hold" button to add your turn's points to your total score and pass the turn to the other player.
    • Continue Rolling: Keep rolling to accumulate more points, but risk rolling a 1 and losing all points for that turn.
  5. Winning the Game: The first player to reach 100 points wins the game.

Features

  • Single or Two-Player Mode
  • Roll dice and hold functionality
  • Turn-based gameplay
  • Score tracking
  • Simple and intuitive user interface

Technologies Used

  • HTML5
  • CSS3
  • JavaScript

Getting Started

To run the game locally, follow these steps:

  1. Clone this repository to your local machine.
  2. Open the index.html file in your web browser.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This game is created for educational and entertainment purposes only. The code provided is open-source, and you are free to use, modify, and distribute it as per the license agreement.

Enjoy playing the game! 👩🏻‍💻

About

A simple JavaScript two-player dice game where the goal is to reach 100 points first. Players roll a die and accumulate points, but risk losing them if they roll a 1.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published