Same idea as HW1, but now you must provide Javascript to make your tic-tac-toe board a little smarter. You don't need to write a tic-tac-toe player, but your board does need to do the following things:
Enforce the rules. This simply means that your board keeps track of whose turn it is, so the players don't have a choice of whether to put an X or an O on the board - simply clicking on a blank square will change the square according to whose turn it is. X always goes first.
Recognize when there is a winner. Your board should be able to tell when a player has won, and should immediately display something telling them that the game is over. You must not allow any more moves once a player has won (they must start a new game).
Recognize when the board is full (when the game has ended in a tie). Your board should display something telling the players that the game is over.
As in HW1, you must provide a way to start the game over. You >do not need to provide a help screen, 2 styles or use an external style sheet.
You don't need frames for this. A table with hyperlinked images will actually be easier to code (and understand).
To attach a Javascript event handler to an image, you put the
image inside a hyperlinks (between <A>
and </A> tags) and
put an onClick attribute in the A tag (not in
the IMG tag).
A Javascript 2-dimensional array can be declared and accessed like this:
|
Please indicate the name of the main document.
Your submission will be processed by a program - you should receive a receipt within a few minutes of your submission. The receipt will include a list of the files we received. (Grading is done by humans, grades will be sent later).
You can submit up to 10 times - we will only grade the last submission! Make sure all the files are in the last submission - it won't be possible for us to collect files from multiple submissions!
If you have questions or problems with the submission system, send email toeiw@cs.rpi.edu - this address goes to humans!
Included below are some screen captures from my game.