EIW Fall 2004 HW2: JavaScript Game

HW2: JavaScript Game

Due: Oct 13th by 11PM
Submissions to WebCT DropBox

You may work with a single partner on this assignment

It is required that you write the code you submit! If you borrow ideas from JavaScript code you find on the WWW (or anywhere else) you must document this in your code (include a comment that indicates where you got the ideas, etc.).




Assignment Description

You are to write a game using Javascript. There is no "server" involved in this game - the browser does all the work (via the Javascript code you include in a web page).

The game is played on a 3x3 grid, each cell of the grid can be in one of two possible states. The goal of the game is to set all of the cells to the same state. Moves are made by clicking on a cell, this changes the state of the cell, and the state of all the immediate "neighbors" of the cell (vertical and horizontal neighbors only, cells on a diagonal are not "neighbors").

There are only three different kinds of moves, corresponding to the three different kinds of cells (the center, any corner, any side). The cells effected by each kind of move are shown below.

1. Center move: toggles the color on all cells next to the center.

2. Side move: toggles the color on all cells next to the selected side cell.

3. Corner move: toggles the color on all cells next to the selected corner cell.

You can use whatever you want to represent the two different "states", in the demo version I the state is indicated by the color of the cell, but your could also use images or whatever you want.

Game Requirements

Your game must include the following:

Demonstration Game

There is a server-based demonstration version of the game running at http://monte.cs.rpi.edu/~hollingd/eiw/hw2/. You should play with this demo version to make sure you understand how the game works.

Go Crazy!

There are lots of ways you can enhance the game, some ideas are listed below. None of these is required (but may be fun to implement).

How to Submit

You must submit your HTML file and any other necessary files (CSS, images, etc) to the WebCT Dropbox set up for HW2 submissions. Feel free to include a text file named README that includes notes about your game, etc.

If you work with a partner, you should only submit once. Make sure you include a file named README in the submission that clearly states the names of both of the team members.