|
|
Give a lot of thought to the structure of this code before you begin
working on implementing the project. There are a lot of details which you
could get lost in. Having to rework major sections of code because you did
not plan ahead will be very frustrating. Map out how you will store user
information, how you will access it, and how you will maintain it on paper
before writing code. It will really help.
In this project, you will implement a game site. We have provided several
javascript games for you. Battleship is available here.
Rock-Paper-Scissors is available here. Dots is available
here.
To copy a game and it's images to your directory, use the following
command at the prompt in Unix (where > is the prompt);
>cp /stage/classes/current/CS101/final/battle/* ~yourusername/html/homework/final/
this is for battleship. replace the instances of battle with rps for
Rock-Paper-Scissors and dots for Dots.
Here is the project:
- Get these games working in your directory.
- Play them. Take a look at the code for each.
- Add a link to each page with a rules page. Rules are available at http://javascript.internet.com/games.
- Create an entry page to your game site. It should have a list of games
and
create a unique user ID for each person. You may NOT prompt the user to
create an ID. You must do it automatically.
(hint: this is a lot like a counter) Call this page index.html.
- Add the capability to pass this user ID around to each page. You may
do this with a cookie, or by making each file a cgi that receives it in a
hidden field (or anything else you like).
- Look at the end of each game's main html file. There is a form
there. This form
contains the user's score. Modify this form so that the user may submit
the score to a cgi that you will write. Be sure to include the user ID and
game name as
submitted information.
- Write a cgi which will take the user ID, game name, and score, and
write this information to a file. You might want a unique file for each
user (just open the user file, write in the game name and score), or you
may have one big file with all the user ID's and scores. Think about this
before you start.
- The user should be able to play any games and submit their current
score to be recorded in this file. If they have already played a game,
keep the highest score in the
file. If they have not played, record the current score as the highest.
- After submitting their score, the user should see a page which lists
their current high score on each game.
- Give the user the option to end their session. This will take them to
a page where they are compared against the current top five scores for
each game.
- Show the top five scores for each game with the record-holder's name
and score.
- For each game, determine if the current user has a high score. Compare
their submitted score against
the high scores recorded in a file. Hint: try using a separate file for
each game.
- If the current user has a high score, prompt them to enter their
name,remove the current lowest score on the list, and insert the user. The top
five scores should be listed in descending order (highest to lowest).
- If the current user does NOT have a high score, just print out the
current high scores.
- Allow users to view the current top score list at any time
- Hint: This is a lot like the online example to add
or search a
database. If the user has just ended their session, submit a hidden
variable "type" which indicates they are about to compare their score. If
you detected a high score, submit a hidden variable "type" which indicates
the user is going to change the current high scores. If the user has just
clicked a link to view the top 5 scores, set a hidden variable "type" to
indicate they are viewing. This will allow you to use the same CGI for all
types of processing regarding top scores.
This assignment is due Sunday, March 11 at midnight. If you turn it in by
Wednesday, March 7, you will receive a 5% bonus (105% of your actual
score). To submit your project early, please fill out this form. If you submit this form, you may not
change your mind. Your project submission is final.
Style Counts. You don't need to change the HTML on the game pages,
but
the rest of your site should employ all of the
devices of good design which we discussed all quarter. Use intersting
graphics, color schemes, and make the site look professional. A notable
portion of your grade will be based on style and design. We recommend a
navigation bar (link to each game, the high scores list, the user's
current data page, back to the home page, and anything else). As
usual, these files should be in html/homework/final.
|