CMSC104, Spring 2009
Programming Project 2
Rock, Paper, Scissors!


Out: Tuesday, November 3, 2009
Due Date: Tueday November 17, 2009 before 11:59 p.m.

The Objective

This project is designed to give you practice with loops and switch statements. You will also get practice designing and writing your first JavaScript program from scratch.

The Task

The program you write will implement the classic game of Rock, Paper, Scissors. If you are not familiar with the game, please read the Wikipedia page about the game. Your program should allow the user to play against the computer. You should keep a running total of the number of player wins, losses, draws (ties) and games played. When the user is finished playing, you should display the statistics for that run of games.

Extra Credit

For extra credit use document.write() to print the output, and to allow multiple play throughs by using a function that plays the game when the user clicks on a link. To create an html link that calls a javascript function use:

	<a href="" onclick='nameOfFunction();'>Click here to play again!</a>

If you opt to do this, you still must keep track of the number of wins, losses etc... Make sure any variables you declare and initialize to keep track of the statistics are delcared/initialized outside of the function you made to play the game. If you put them inside the function, they'll be reset every time the funciton is called!

Screenshots

Welcome screen

Get ready screen

User entering incorrect input

Error message for incorrect input

Getting the input

Showing the computer's guess

Displaying the results

Asking to play again - yes

Getting another input

Showing the computer's guess

Displaying the results

Asking to play again - no

Displaying the statistics

Submitting the Program

You do not have to do anything to submit the program. It should be in your pub/www/cs104/proj2 directory.