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.
- Set a target score for the game
- Track scores for two players
- Automatically declare a winner when the target score is reached
- Reset game state with a single button click
- Responsive design for mobile and tablet devices
The game uses JavaScript event listeners to update the scores and check for a winner. Here's a high-level breakdown:
- The game stores HTML elements in JavaScript variables for easy access.
- Global variables track the current score, target score, and player scores.
- Event listeners on the player buttons update scores and check for a winner.
- The winner is declared when the sum of both player scores reaches or exceeds the target score.
- Target Score: Select the target score from a dropdown menu.
- Player Scores: Displayed prominently on the screen.
- Player Buttons: Click to increment player scores.
- Reset Button: Reset game state to start a new game.
- Winner Display: Shows the winner or a draw message.
- HTML5
- CSS3
- JavaScript (ES6+)
Contributions are welcome! Fork the repository, make changes, and submit a pull request.
- Font used: Nunito (Google Fonts)
- Inspired by classic Ping Pong games