Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎮 Rock Paper Scissors Game

A simple and interactive Rock–Paper–Scissors game built using HTML, CSS, and JavaScript. This project is beginner‑friendly and demonstrates DOM manipulation, event handling, and basic game logic in JavaScript.


📌 Features

  • Play Rock, Paper, or Scissors against the computer
  • Random computer choice generation
  • Real‑time score tracking (User vs Computer)
  • Dynamic result messages (Win / Lose / Draw)
  • Clean and responsive UI
  • Hover effects for better user interaction

🛠️ Technologies Used

  • HTML5 – Structure of the game
  • CSS3 – Styling and layout
  • JavaScript (Vanilla) – Game logic and interactivity

📂 Project Structure

rock-paper-scissors/
│
├── index.html        # Main HTML file
├── style.css         # Styling
├── app.js            # Game logic
├── images/           # Game icons
│   ├── rock.png
│   ├── paper.png
│   └── scissors.png
└── README.md         # Project documentation

▶️ How to Run the Project

  1. Clone the repository:

    git clone https://github.com/your-username/rock-paper-scissors.git
  2. Navigate to the project folder:

    cd rock-paper-scissors
  3. Open index.html in your browser.

✅ No additional setup required.


🎯 How the Game Works

  1. Click on Rock, Paper, or Scissors.

  2. The computer randomly selects its move.

  3. The game logic compares both choices:

    • Same choice → Draw
    • Rock beats Scissors
    • Paper beats Rock
    • Scissors beats Paper
  4. Scores are updated instantly.

  5. A message displays the result of each round.


🧠 JavaScript Logic Overview

  • genCompChoice() – Generates a random computer move
  • playGame(userChoice) – Main game logic
  • showWinner() – Updates scores and result message
  • drawGame() – Handles draw scenarios
  • Event listeners detect user clicks

🎨 UI Highlights

  • Circular choice buttons with hover effects

  • Centered layout using Flexbox

  • Dynamic message background color:

    • 🟢 Green → Win
    • 🔴 Red → Loss
    • 🔵 Blue → Draw

🚀 Future Improvements

  • Add sound effects
  • Add reset button
  • Add animations
  • Make mobile‑first responsive
  • Multiplayer mode

📸 Preview

(Add a screenshot or GIF of your game here)


🤝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a new branch
  3. Make your changes
  4. Submit a pull request

📜 License

This project is open source and available under the MIT License.


🙌 Author

Your Name GitHub: your-username


⭐ If you like this project, don’t forget to star the repository!

Releases

Packages

Contributors

Languages