A fun two-player dice game where players race to 100 points by rolling and holding dice.
Built with the tools and technologies:
- 📍 Overview
- 👾 Features
- 📁 Project Structure
- 🚀 Getting Started
- 📌 Project Roadmap
- 🔰 Contributing
- 🎗 License
- 🙌 Acknowledgments
The Pig Game is a simple, fun, and interactive two-player dice game.
Players take turns rolling a dice:
- If a player rolls 1, they lose their current round score and the turn switches.
- If they roll 2–6, the value is added to their round score.
- A player can “Hold” to add the round score to their total score and pass the turn.
- The first player to reach 100 points wins. 🎉
This project demonstrates JavaScript DOM manipulation, event handling, game logic, and CSS styling.
- 🎲 Dice Rolling Mechanic: Adds randomness and fun.
- 🏆 Win Condition: First to reach 100 points wins.
- 🔄 Turn Switching: Rolls a 1 = automatic switch.
- ⏸ Hold Function: Secure your points instead of risking another roll.
- 🎨 Clean UI & Responsive Design: Styled with CSS for a modern look.
└── pig-game/
├── Images
│ ├── dice-1.png
│ ├── dice-2.png
│ ├── dice-3.png
│ ├── dice-4.png
│ ├── dice-5.png
│ ├── dice-6.png
│ └── pig-game-flowchart.png
├── index.html
├── script.js
└── style.css
PIG-GAME/
__root__
style.css 🎨 Styles the layout and design of the game. script.js ⚡ Implements the game logic and interactivity. index.html 📄 The main HTML file containing the game structure.
You only need a modern web browser (Chrome, Firefox, Edge, etc.).
Clone the repository:
git clone https://github.com/khalidrahmanhanify/pig-gameNavigate to the project directory:
cd pig-gameSimply open the index.html file in your browser to start playing.
No automated test suite is included — manual play-testing is recommended.
- 🎲 Basic game logic implemented.
- 🎨 UI styling with CSS.
- 🔊 Add sound effects for rolls and wins.
- 📱 Enhance responsive design for mobile play.
- 🕹️ Add custom winning score input.
Contributing Guidelines
- Fork this repository.
- Clone your fork:
git clone https://github.com/your-username/pig-game
- Create a new branch for your feature/fix:
git checkout -b feature-name
- Commit your changes with a descriptive message.
- Push to your branch and open a Pull Request.
This project is licensed under the MIT License – see the LICENSE file for details.
- 🎓 Inspired by Jonas Schmedtmann’s JavaScript Course
- 💡 Thanks to open-source contributors for icons and shields