CIT 597 Assignment 6: Scissors-Paper-Stone in JavaScript
Fall 2003, David Matuszek

Purposes of this assignment:

Idea of the assignment:

Your assignment is to write, in JavaScript, a program to play Scissors-Paper-Stone (also called Rock-Scissors-Paper and other variations; other names are Roshambo and Jan-Ken-Pon). Your program should be executable from a web page.

In more detail:

In this two-player game, each player chooses one of Scissors, or Paper, or Stone. The winner is determined as follows:

Source: Art Explosion 125000 Images

Stone breaks scissors
    (stone wins)

Scissors cut paper
    (scissors wins)

Paper covers stone
    (paper wins)

Your program is to choose one of the three options, accept the human's choice, and display the result. It should keep a running total of the number of games played and the number won, lost, and tied, and display this result after each game.

Your program should not choose completely at random. Instead, keep track of the user's plays, and base your strategy on that. In my experience, it is fairly easy to do better than pure chance in games like this by basing your next play on (1) what your opponent played last time, and (2) whether your opponent won, lost, or tied last time. For Scissors-Paper-Stone, this would mean keeping track of nine quantities: How many times your opponent played:

Scissors and won Scissors and lost Scissors and tied
Paper and won Paper and lost Paper and tied
Stone and won Stone and lost Stone and tied

Most of the logic should be in functions in the <head> of the HTML page.


I'll ask for these specifics:

Please make your program as user-friendly as possible. If it's hard to figure out what to do, we'll deduct points.

I will not answer questions about what the "GUI" (if you can call it that) should look like. It's part of your job to figure out how to make this "game" as intuitive as possible. (Note, however, that document.write(...) should only be used when the document is being loaded; if used later, instead of writing into the document, it rewrites the entire document!)

Due date:

Saturday, November 1, before midnight.