Skip to content

khalidrahmanhanify/pig-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PIG-GAME

A fun two-player dice game where players race to 100 points by rolling and holding dice.

license last-commit repo-top-language repo-language-count

Built with the tools and technologies:

HTML5 JavaScript CSS3


🔗 Table of Contents


📍 Overview

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.


👾 Features

  • 🎲 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.

📁 Project Structure

└── 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

📂 Project Index

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.

🚀 Getting Started

☑️ Prerequisites

You only need a modern web browser (Chrome, Firefox, Edge, etc.).

⚙️ Installation

Clone the repository:

git clone https://github.com/khalidrahmanhanify/pig-game

Navigate to the project directory:

cd pig-game

🤖 Usage

Simply open the index.html file in your browser to start playing.

🧪 Testing

No automated test suite is included — manual play-testing is recommended.


📌 Project Roadmap

  • 🎲 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

Contributing Guidelines
  1. Fork this repository.
  2. Clone your fork:
    git clone https://github.com/your-username/pig-game
  3. Create a new branch for your feature/fix:
    git checkout -b feature-name
  4. Commit your changes with a descriptive message.
  5. Push to your branch and open a Pull Request.

🎗 License

This project is licensed under the MIT License – see the LICENSE file for details.


🙌 Acknowledgments

  • 🎓 Inspired by Jonas Schmedtmann’s JavaScript Course
  • 💡 Thanks to open-source contributors for icons and shields

About

A simple two-player dice game where players race to 20 points by rolling and holding dice.

Topics

Resources

Stars

Watchers

Forks