A simple two-player dice game implemented in JavaScript.
This project is a basic web application that simulates a turn-based dice game between two players. Each player takes turns rolling a six-sided die, with the goal of reaching a specified winning score to win the match.
- Roll the Dice: Players can roll the dice to accumulate points.
- Switch Player: Turns automatically switch when a player rolls a 1.
- Winning Condition: The first player to reach the winning score wins the match.
- Restart the Match: Ability to restart the match after a player wins.
-
Clone the Repository:
git clone https://github.com/zainkhan25/Roll-Dice-Game.git
-
Include the JavaScript File: Include the JavaScript file in your HTML document.
<script src="app.js"></script>
-
Run the Application: Open the HTML file in a web browser.
-
Customize Winning Score: Adjust the winning score in the
switchPlayer()
function in your JavaScript file.if (currentPlayerHighestScore.innerHTML >= 50) { // Adjust the winning score as needed // ... }
- Click the "Start Game" button to initiate the game.
- Players take turns rolling the dice by clicking the "Roll Dice" button.
- Accumulate points with each roll.
- If a player rolls a 1, their score resets, and the turn switches.
- The first player to reach the specified winning score wins the match.
Feel free to contribute to the development of this dice game by opening issues or pull requests.
This project is licensed under the MIT License.