The Skunk Game |
Due Dates:(UPDATED 11/9/98)
In order to work on this assignment, you are to use the "Open File" option in the Netscape browser to view and run your assignment. Remember that this will only open a file on the physical machine that you are working with. If you are running Netscape on one of the EECS machines, you can open any file in your account (not only the ones in your WWW directory). If you are not running Netscape on one of the EECS machines, you will have to transfer the file to the machine your are working on before you can open the file in Netscape. To transfer the file, use either FTP or Fetch.
Another note on academic dishonesty, you should never show your written code for an assignment to another student. You may discuss ideas related to the project, but code must be entirely written on your own. If you and another student must discuss code, you must discuss an example other than the assignment.
The goal of the game is to roll the dice for points and the first person who gets 100 points wins. The player determines how many times they wish to roll the dice during their turn provided they don't get "skunked". Once a player gets skunked, their turn is over and may lose some or all of their points as a result.
There are two ways to get skunked:
The player can end their turn at any time after they have made at least one roll. A roll consists of rolling both dice. If a "one" does not appear, the value on both dice are added to the players score. Let us look at some examples turns to better understand the game.
Assume player 1 currently has 27 points. The following table will show how the player's turn went:
Comments | Dice Roll | Score | |
---|---|---|---|
Start of turn | 27 | ||
Roll 1 | 3 | 4 | 34 |
Roll 2 | 5 | 4 | 43 |
Roll 3 | 2 | 2 | 47 |
Roll 4 | 6 | 3 | 56 |
End of turn | 56 |
Assume player 2 currently has 52 points. The following table will show how the player's turn went:
Comments | Dice Roll | Score | |
---|---|---|---|
Start of turn | 52 | ||
Roll 1 | 2 | 5 | 59 |
Roll 2 | 6 | 1 | Single Skunk |
End of turn | 52 |
Assume player 3 currently has 70 points. The following table will show how the player's turn went:
Comments | Dice Roll | Score | |
---|---|---|---|
Start of turn | 70 | ||
Roll 1 | 5 | 4 | 79 |
Roll 2 | 2 | 3 | 84 |
Roll 3 | 1 | 1 | Double Skunk |
End turn | 0 |
Your program must have three computer players to play against.
The user player always goes first. When their turn is over the three computer players get turns (one turn per computer player). When a player wins, there must be a message displayed stating who the winner of the game was. One way to do this is by alert box.
Your program must have a "New Game" button. When clicking on this button, all players return to zero points and the game starts with the user player taking their turn. Your program must also have a "Quit" button. When clicking on this button, the previous web page it redisplayed (this is nothing but a "back" button"). Your program must have three additional HTML pages that provide supporting information.
Make sure your code is written using good programming style. This includes the use of comments, indentation, blank lines and meaningful identifier names. Each function that you write must have comments at the start explaining the purpose of the function. Also, at the top of your HTML file must have a comment explaining the purpose of the file including your name, and lab section day and time.
As always, late assignments will not be accepted.
You must electronically submit your assignment using the UNIX command turnin. Note that since this assignment does not have to be in your WWW directory, you will be graded based on what is turned in. If you do not turn in your assignment correctly, your grade will suffer. To electronically hand in your assignment using the UNIX turnin type one of the following commands depending on which lecture your are registered, where FILELIST is the names of all of the files you are submitting.