Pong

In this document we will explain the game of Pong, an interactive computer game. This implementation is very similar to a number of other versions of the game.

Basic Pong Components

Pong is an arcade game whose starting configuration is shown in Figure 1. The play field is rectangular, bounded by two walls, a ceiling, and a floor. The play field is empty except for a black strip for decoration.” A player’s objec­tive is to get a puck past his opponent. A puck bounces off the ceiling and floor, and the paddles. A player scores a point for every puck absorbed by the opponent’s wall.


 

 

Figure 1 The Pong Startup Configuration

When play starts, a puck placed in the center of the left wall and begins to move the right and down. The paddle is controlled by the player via a mouse attached to the computer. The player must move the paddle so that the puck hits the paddle and not the wall behind the paddle. When the puck hits the paddle, it bounces backward. If the puck misses the paddle and hits the wall, it is removed from play and one of the remaining pucks is put into play.

Pong Physics

As the puck moves through the play field, it encounters various components of the play field. The interactions between them are as follows [see also Figure 2 and Error! Reference source not found..

Ceiling and floor

The puck bounces off the ceiling and floor in accordance with the laws of physics, neglecting friction and gravity—that is, angle of reflection equals angle of incidence.

 

 

Figure 2 Interactions between Puck and Boundaries

Wall

The wall absorbs pucks. A puck that hits the wall does not rebound, but is removed from play.

Paddle

The player uses a paddle to control the direction of the puck. The puck bounces off the paddle based on the direction of the puck as it hits the paddle and on which part of the paddle is hit. Divide the paddle into thirds and define the near third as being the left third of the paddle if the puck is coming in from the left and the right third if the puck is coming in from the right. Define the far third similarly, and the middle third as the remaining third. The rules of reflection are as follows:


·         If the puck hits the paddle on its near third then the puck returns in the exact opposite direction from which it came.

·         If the puck hits the paddle on the middle third then the angle of reflection is a little steeper than the angle of inci­dence. The puck’s movement is constrained such that it must never be completely vertical.

·         If the puck hits the paddle on the far third then the angle of reflection is a little shallower than the angle of inci­dence. The puck’s movement is constrained such that it must never be completely horizontal.

 

 

Figure 3 Puck interactions with the paddle.

Puck

The player is given a fixed number of pucks at the beginning of the game, but only one is in play at any given time. Once one puck hits the wall, the next is brought into play, assuming another is available. The puck has a current direction and speed and moves according to an automatic timer. As seen above, collisions may change the direction of the puck, but not the speed.

Game Environment

The first implementation of Pong is to run as an application within a Microsoft Windows® environment and behaves as follows:

·         The game shall start when there is a left mouse click.

·         A player can “exit” the game at any time before it is won or lost.

·         A player can “pause” the game at any time until play ends.

·         A player can “resume” a paused game.