CSC 551: Web Programming
Spring 2003
JavaScript Project
For your class project, you are to write an interactive Web page that
allows the user to play the game Dots and Boxes. In the game, an
8x8 grid of dots appear initially, and two players alternate drawing a horizontal
or vertical line to connect two dots. If a player is able to draw a line that
completes a square, then they capture that square and get another turn.
The player with the most captured squares
at the end of the game (when all lines have been drawn) is the winner.
Your page is to pit the user against the computer in playing the game. The
user is allowed to go first, then alternates turns with the computer
(i.e., your program). Your logic for playing the game may be as sophisticated as
you like. However, it should ensure the following:
- If your program can make a move that captures a square, it must do so.
- If your program can avoid allowing the user to capture a square, it must
do so.
Your page must provide a reasonable interface for the game. It should also
be robust. Illegal moves such as selecting a line that has already been drawn
or trying to move while it is the computer's turn, should be caught and handled.
To make the page user-friendly, it should
provide help facilities that describe the rules and give instructions on
how to interact with the page. Part of the grade for the project will be
based on the elegance of the page design and its overall usability.
You may work with a partner in developing this project. In fact, working as
a team is encouraged, since discussions about design and debugging often lead
to a more robust, user-friendly application. If you do work in a team, only
one program need be submitted for the team. To allow plenty of time for
collaboration and feedback from the instructor, this assignment will be
spread over the rest of this semester.
- Part 1: Design, due 3/26 (25 pts.)
- At this point, you must turn in an on-paper design for your page.
You should draw a picture of your page, with comments to describe the
interface and the behavior of each of the page elements. You do not need to
provide implementation details -- simply describe the behavior of each page
element and the interactions that must occur with the user as a game is played.
- Part 2: Prototype, due 4/14 (75 pts.)
- At this point, you must have a working prototype. That is, the game must
alternate between moves selected by the user and those selected by the program.
Your prototype should recognize captured squares, maintain and display a
running score, and recognize when the game is over. If a player captures a square
on a given move, their turn should
continue as long as they continue to capture squares. However, the logic of the
computer's move does not need to be complete at this point: for example, a random move
is acceptable. The prototype does not need to be robust:
you may assume that moves entered by the user are legal.
- Part 3: Final Version, due 4/30 (100 pts.)
- At this point, the page must fully implement the game. The computer strategy
must meet the requirements listed above, and all illegal moves should be caught
and handled by the page. In addition, help facilities should be provided.
For EXTRA CREDIT, you may add additional features to your page. For example,
you might add a best score feature to the game, so that the best score for an
individual player is remembered (using cookies from
www.creighton.edu/~davereed/csc551/JavaScript/cookie.js).
Reminder: You are expressly forbidden to
look at anyone else's source code for a comparable game.