Pong


Use W/S for left paddle and Up/Down arrows for right paddle.

Mode: Player vs AI

High Scores - Player 1: 0, Player 2: 0

Code Evolution History

Update at 2025-07-11 11:56:50

The improved code introduces new features such as the ability to adjust game speed with "Increase Speed" and "Decrease Speed" buttons, which dynamically alter the ball and paddle speeds. Additionally, the game now supports saving and displaying high scores using local storage, and includes a feature to display the game's frames per second (FPS) on the canvas.

Update at 2025-07-11 11:53:17

The improved code introduces a new feature that tracks and displays high scores using local storage, allowing the game to save and retrieve the highest scores for both players across sessions. Additionally, the HTML and CSS were updated to include a new section for displaying these high scores.

Update at 2025-07-11 11:22:22

The improvements to the Pong game include the addition of sound effects for hits and wins, a feature to change the game's color theme, and power-up types that can speed up the ball or shrink the paddle. Additionally, a new multiplayer mode has been introduced, and a feature to display the game's FPS (frames per second) on the screen has been added.

Update at 2025-07-11 08:07:16

The improved code introduces a new feature to display the frames per second (FPS) on the screen, enhancing the game's performance monitoring. Additionally, the CSS now includes a new style for the FPS display, positioning it at the top-left corner of the canvas.

Update at 2025-07-11 07:03:29

The improved code introduces a new multiplayer mode allowing two players to control paddles using 'W/S' keys for the left paddle and 'Up/Down' arrows for the right paddle. Additionally, the HTML instructions have been updated to reflect these new controls, while the CSS remains unchanged.

Update at 2025-07-11 06:30:43

The improved JavaScript code introduces a new variable `powerUpVisible` to manage the visibility of power-ups separately from their activity, ensuring power-ups disappear visually before being deactivated. Additionally, the `spawnPowerUp` function is updated to reflect this change, enhancing the game's visual feedback when power-ups are collected. The CSS and HTML remain unchanged.

Update at 2025-07-11 06:18:53

The improved code introduces a new power-up type, "shrinkPaddle," which temporarily reduces the paddle height when collected, in addition to the existing speed power-up. It also includes a visual indicator for different power-up types by changing the power-up's color based on its effect, enhancing gameplay dynamics.

Update at 2025-07-11 06:15:00

Implemented a `ballSpeedMultiplier` to prevent cumulative speed increases. The multiplier is applied to ball speed calculations and reset to 1 at the start of each game, ensuring consistent speed across restarts regardless of power-up activations.

Update at 2025-07-11 06:12:04

The improved code introduces a new feature allowing players to toggle sound effects on and off, with a button labeled "Sound: On/Off" added to the HTML controls. Additionally, the JavaScript logic now checks if sound is enabled before playing any audio effects.

Update at 2025-07-11 06:00:00

Further refined the ball speed reset logic by ensuring `ballSpeedY` is also reset to `INITIAL_BALL_SPEED` in `resetBall()` and `startGame()` to prevent cumulative speed increases from power-ups across game restarts.

Update at 2025-07-11 05:55:49

The improved code introduces new sound effects for hits and wins, adds a feature to change the game theme with a button, and updates the CSS to use a CSS variable for the theme color. This enhances user experience by providing auditory feedback and visual customization options.

Update at 2025-07-11 05:55:00

Corrected the game speed issue by explicitly resetting ballSpeedX and ballSpeedY to their initial values within the startGame function, ensuring consistent game speed across restarts.

Update at 2025-07-11 05:50:00

Fixed an issue where the game would speed up after each restart by ensuring the ball's speed is reset to its initial value in the `resetBall()` function.

Update at 2025-07-11 05:45:00

The game now displays a countdown from 5 to 1 on the win screen before restarting in AI vs AI mode.

Update at 2025-07-11 05:40:00

The bounce.mp3 file was moved to assets/audio/ and its path updated in pong.js. The game now starts automatically in AI vs AI mode on page load, and after a win, a 5-second countdown is displayed before the game restarts in AI vs AI mode.

Update at 2025-07-11 05:33:22

The improved code introduces a power-up feature that increases the ball's speed upon collision, and includes a victory screen that displays when a player reaches the winning score. Additionally, the game now has a pause feature that prevents pausing after a game ends, and the code has been refactored for better readability and maintainability.

Update at 2025-07-11 05:29:12

The improved code introduces a new feature that sets a winning score of 5, displays a victory message when a player reaches this score, and prevents the game from being paused after it ends. Additionally, the game now shows a win screen with the winner's name and an invitation to restart the game. No changes were made to the CSS or HTML.

Update at 2025-07-11 05:25:24

The improved Pong game code introduces a new feature: a power-up that appears randomly on the canvas, which, when hit by the ball, increases the ball's speed by 1.5 times. Additionally, the CSS was updated to use specific color codes for button backgrounds instead of CSS variables, ensuring consistent button styling across different themes.

Update at 2025-07-11 05:22:08

The improved code introduces a dynamic update to the game mode display in the HTML by setting the inner text of the `gameModeDisplay` element to reflect the current game mode when the game starts. No changes were made to the CSS or HTML structure itself.