Programming Assignment 1
A JavaScript Game

Due on Tuesday February 4 before midnight


The goal of this project is to learn JavaScript and DOM by implementing a simple computer game, reminiscent to the Pong arcade video game from the 70s.
This project must be done individually. No copying is permitted. Note: We will use a system for detecting software plagiarism, called Moss, which is an automatic system for determining the similarity of programs. That is, your program will be compared with the programs of the other students in class as well as with the programs submitted in previous years.


You will do this project on your own PC/laptop. You have to use the Mozilla Firefox web browser and you can use the firebug plugin for debugging your JavaScript code. To run JavaScript expressions, such as print the value of a variable, activate Firebug and on its Console menu select "Show Command Editor", then type an expression such as 1+2 and hit Run.


The following web pages contain various tutorials. Use them as a reference only. The class slides contain enough information on JavaScript and DOM.

Project Description

You need to write a JavaScript file pong.js, used in the file pong.html, that implements the following actions:

Please watch the video pong.mp4 for a demo of how your game should look like.

Description: The pong court is 1100x600px, the pong ball is 50x50px, and the paddle is 102x14px. When you click left on the court, the ball will start from a random place at the left border of the court at a random angle between -π/4 and π/4. The paddle can move up and down on the right border by just moving the mouse (without clicking the mouse). The ball bounces at the left, top, and bottom borders of the court. If the ball crosses the right border, you loose a point and the game is suspended (you would need to click on the court again to resume). So the goal of this game is to move the paddle to protect the right border by hitting the ball.


Note: You should use plain JavaScript. You should not use any JavaScript library, such as JQuery. You should not use the JavaScript canvas object.

What to Submit

Use the form below to submit your pong.html and pong.js files. We do not accept email or hardcopy submissions. You need a username and password to submit your project. You should have already received an email from your instructor at your account with your username and password. You may submit multiple files, if you like, as long as they have different names. These files are automatically uploaded directly into your personal class account for this particular project, so you don't have to include your name or student ID or project number in the file name. You may submit your files as many times as you like, but only the most recently submitted files will be retained and evaluated (newly submitted files replace the old files under the same file name). After you submit the files, please double-check that your submitted files are correct by clicking on the Status link and by playing your game on your browser. If you cannot login or have a problem submitting the project using this form, ask the GTA for help.

Submit Project #1:

Last modified: 01/23/14 by Leonidas Fegaras