Skip to content

Latest commit

 

History

History
43 lines (23 loc) · 1.64 KB

README.md

File metadata and controls

43 lines (23 loc) · 1.64 KB

Pig Game

Overview

Pig Game is a simple, yet fun dice game where players take turns to roll a single die as many times as they wish, or until they roll a 1. The aim of the game is to score 100 points before your opponent does.

How to Play

Each turn, a player repeatedly rolls a die until either a 1 is rolled or the player decides to "hold":

  • If the player rolls a 1, they score nothing and it becomes the next player's turn.
  • If the player rolls any other number, it is added to their turn total and the player's turn continues.
  • If a player chooses to "hold", their turn total is added to their score, and it becomes the next player's turn.

The first player to score 100 or more points wins.

Project Structure

The project is structured into two main files: index.html and script.js.

index.html

This file contains the HTML structure of the game. It includes sections for each player, displaying their total score and current score. It also includes buttons for rolling the dice, holding the current score, and starting a new game.

script.js

This file contains the JavaScript logic of the game. It includes functions for initializing the game, switching the active player, rolling the dice, and holding the current score.

How to Run

To play the game, simply open the index.html file in your web browser.

Screenshots

Unfortunately, screenshots are not available in this markdown file. Please refer to the index.html file to view the game interface.

Contributing

Contributions are welcome! Please feel free to submit a pull request.

License

This project is open source, feel free to use, modify, and distribute the code.