/dice-game

Primary LanguageJavaScript

Dice Game

Welcome to the Dice Game! This is a simple JavaScript project that allows two players to play a dice game. In this game, Player 1 will roll the dice, and based on the outcome, they can accumulate points or lose their turn.

How to Play

  1. Open the Dice Game in your preferred web browser.
  2. The game starts with Player 1. Click the "Roll Dice" button to roll the dice.
  3. The number on the dice will be added to Player 1's temporary score.
  4. Player 1 has two options:
  • Hold: Click the "Hold" button to add the temporary score to the current total and end your turn.
  • Roll Again: Click the "Roll Again" button to roll the dice again and potentially add more points to your temporary score.
  1. If Player 1 rolls a 1, their temporary score will reset to zero, and their turn ends.
  2. Once Player 1 decides to hold or rolls a 1, it becomes Player 2's turn.
  3. Player 2 follows the same rules as Player 1.
  4. The game continues alternating between Player 1 and Player 2 until one of the players reaches a predefined winning score (e.g., 100 points).
  5. The player who reaches the winning score first is declared the winner, and the game ends.

Technologies Used

  • HTML
  • CSS
  • JavaScript

Project Structure

The project includes the following files:

  • index.html: The main HTML file that displays the game interface.
  • style.css: The CSS file that styles the game interface.
  • script.js: The JavaScript file that contains the game logic.

How to run locally

To run the Dice Game project locally, follow these steps:

  • Download the project files from the repository.
  • Open the index.html file in your preferred web browser.
  • Alternatively, you can use a development server or set up a local web server to host the project files.

Demo

A live demo of the Dice Game project can be found at https://araib-dice-game.netlify.app/

Contributing

Contributions to the Dice Game project are always welcome. If you have any suggestions or improvements, please submit a pull request. Before contributing, make sure to discuss your changes with the repository owners.