V22.0005 - Spring 2001
Nathan Hull
Assignment # 3

Due: Thursday, March 1st

Projects should be turned in two ways:

1) Posted on your I5 Web account under the name "assign3.html"

2) Put on a single 3 1/2" floppy disk, and turned in with complete, COMMENTED listings in an envelope.

You are to write a JavaScript program which will simulate a slot machine. Note that this is somewhat similar to the "dice game" which we did in class.

The basic game should consist of three wheels, with each wheel having a minimum of ten settings. ONE of the positions on each wheel should be a picture of the NYU torch. There should be two buttons, one labeled Spin" and the other one "Stop". Finally, there should be two text fields, representing your "Bank" and the other one representing your "Bet."

Before you play, you can type dollar amounts into the text fields for "Bank" and "Bet". These will be updated by the JavaScript program when you play.

When you push the "spin" button, the three stationary gif pictures are replaced with three pictures of rapidly turning wheels. (These are just animated gifs, and actually don't represent any eventual outcome.) When you hit the "stop" button, three RANDOMLY chosen wheels are displayed. If you have won, your bank should be increased accordingly. If you have lost, your total should be decreased. If you have hit the Jack Pot (three NYU torches in a row), you should PAUSE for 3 seconds, and then proceed to a different HTML file, where you will provide a brief celebratory GIF animation. At the conclusion of that animation, the JavaScript should return you to the original screen.

Here is a screenshot showing three possible views of the slot machine in action:

You should provide a link to an "Instruction Page" which clearly states the rules, how many positions on each wheel, the frequency of each symbol and a VISUAL guide to each winning combination. There should be at least one "WILD CARD" character which matches any winning combination. Feel free to make up winning combinations, and the points awarded for each.

Make certain that the player cannot make the "Stop" button work without first pressing the "Spin" button. You could implement this by setting a variable. (The best method would be by setting a Boolean variable, but you may use another method if you like).

Your program should be well structured and be broken into functions.

(Hint on JavaScript: Since you will be both setting variables and checking them, remember that "=" is used to set the value of a variable, while "==" is used in an IF statement to check its value!)