A fun and simple dice game for two players built with HTML, CSS, and JavaScript.
Pig Game is a classic dice game where two players race to reach 100 points first. Players take turns rolling a dice and accumulating points, but there's a catch - if you roll a 1, you lose all your current round points!
- Roll Dice: Click "Roll Dice" to roll a random number (1-6)
- Add Points: If you roll 2-6, points are added to your current score
- Hold: Click "Hold" to add your current score to your total score
- Avoid 1: If you roll a 1, you lose all current points and turn switches
- Win: First player to reach 100 total points wins!
- Players take turns rolling the dice
- Rolling 2-6: Points are added to current score
- Rolling 1: Current score becomes 0 and turn switches to other player
- Hold: Add current score to total score and switch turns
- First to reach 100 points wins the game
- Download or clone this repository
- Open
index.htmlin your web browser - Start playing!
git clone https://github.com/yourusername/pig-game.git
cd pig-game
# Open index.html in your browser- HTML5 - Game structure
- CSS3 - Styling and animations
- JavaScript - Game logic and functionality
pig-game/
โ
โโโ index.html # Main HTML file
โโโ style.css # CSS styling (if separate)
โโโ script.js # JavaScript game logic (if separate)
โโโ dice-1.png # Dice images
โโโ dice-2.png
โโโ dice-3.png
โโโ dice-4.png
โโโ dice-5.png
โโโ dice-6.png
โโโ README.md # This file
- โ Two-player gameplay
- โ Random dice rolling
- โ Score tracking
- โ Current score display
- โ Winner detection
- โ Game reset functionality
- โ Responsive design
- โ Smooth animations
Feel free to fork this project and submit pull requests for any improvements!
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
- Inspired by the classic Pig dice game
- Built as part of JavaScript learning journey
- Thanks to The Complete JavaScript Course for guidance
Enjoy the game! ๐
Made with โค๏ธ and JavaScript