| WebSys Fall 2006 HW2: JavaScript Lights Out |
| WebSys Home |
You need to create an HTML document (that includes JavaScript) that provides a Lights Out game. Lights Out is a puzzle played on a square grid, in which the object it to get all the grid cells to be a specific color. The traditional puzzle is played on a 5x5 grid, your submission must allow the user to choose any size 4-10 (inclusive).
Note: You are not being asked to write javascript that can solve this puzzle, just provide a web page in which the user can play the puzzle. All puzzle functionality must be provided by javascript (no Java applets, flash, etc).
For general information about Lights Out, online versions, mathematical background, etc - refer to the following:
There are a number of JavaScript implementations of the game you may find on the Web. Feel free to get ideas from these, but you must write every line of the code you submit. It is not acceptable that your code is based on someone else's code (including any of the versions you find online). I have a number of tools that can detect similarities between programs and will be using them to catch this. Minimum penalty is a 0 on the assignment and a 2 letter grade drop for your final grade. I am the world authority on catching cheaters, author of a book and many articles on catching cheaters, I do this for fun...
Start a new game at any time (by pressing a button or some similar action). You need to use a random number generator to produce a different game each time!. NOTE: You don't have to ensure that the game generated is solveable!
The user must be able to pick a board size. You only need to support boards that are square and have no fewer than 3 and no more than 10 rows.
Recognize when someone has won and provide some indication that the user is brilliant. You can pop up an alert, or arrange for a message to appear in the web page, or flash colors or whatever... The point is, your program must recognize when the puzzle has been solved.
You decide how the user makes moves. You can capture keyboard
events with onKeyPress, or have the user use the
mouse - anything is fine (although it must be easy to understand
how to make moves!).
You should definitely be using CSS!
Feel free to put CSS and/or Javascript in separate files that are referenced from your HTML file. Make sure you submit them all!
You need to submit your HTML file to the WebCT dropbox labeled "hw2". If your page references any images, javascript or css files, you must also submit those files, and your HTML document must use relative URLs!. We will be viewing your submissions on our machines, not on yours, so if you have something like the image tag shown below we won't see your images and you will lose points!:
<img src="file://c:/eiw/blah.gif">
| WebSys Fall 2006 |