Skip to content

Latest commit

 

History

History
46 lines (38 loc) · 1.65 KB

README.md

File metadata and controls

46 lines (38 loc) · 1.65 KB

Notes_241113_102514_efc

💫Overview

A lightweight JavaScript-powered ping pong score tracker with automatic winner detection and reset functionality. This game allows two players to track their scores and declare a winner based on a predefined target score.

🪄Features

  1. Set a target score for the game
  2. Track scores for two players
  3. Automatically declare a winner when the target score is reached
  4. Reset game state with a single button click
  5. Responsive design for mobile and tablet devices

⚙️How the Code Works

The game uses JavaScript event listeners to update the scores and check for a winner. Here's a high-level breakdown:

  1. The game stores HTML elements in JavaScript variables for easy access.
  2. Global variables track the current score, target score, and player scores.
  3. Event listeners on the player buttons update scores and check for a winner.
  4. The winner is declared when the sum of both player scores reaches or exceeds the target score.

🌈User Interface

  1. Target Score: Select the target score from a dropdown menu.
  2. Player Scores: Displayed prominently on the screen.
  3. Player Buttons: Click to increment player scores.
  4. Reset Button: Reset game state to start a new game.
  5. Winner Display: Shows the winner or a draw message.

📦Technologies Used

  1. HTML5
  2. CSS3
  3. JavaScript (ES6+)

💡Contributing

Contributions are welcome! Fork the repository, make changes, and submit a pull request.

🥂Acknowledgments

  1. Font used: Nunito (Google Fonts)
  2. Inspired by classic Ping Pong games