COSC 231 FALL 2011 Project #3: Slime Trail
Distributed: 11/8/2011 Due: 11/21/2011
Short Description
Implement the 2 player board game Slime trail using Javascript, HTML and CSS.
Game play
This is a turn-based game. There are two players: human (Green) and computer (Red). The game board is a grid. Allow the
human to choose between a 3X3 grid and a 5X5 grid (other sizes are permitted).
The Green goal is marked with color green and is located in the upper left corner; the Red goal is marked with color
red and is located in the lower right corner.
There is a single piece on the board. Players take turns moving that piece. A player moves to a new position by clicking on the
new position. The former position is marked with color black (the slime).
A position which has been slimed (marked black), cannot be revisited.
A legal move is to an empty square (including goals) which is a 4 neighbor (N, S, E, W) of the current position.
When a player moves to a goal, the game is over and goal's owner is the winner (it does not matter which player made the
move).
If there is no legal move for the current player, the game is over and is a draw.
To start, use the "pie rule". The computer generates a random position on the grid
and places the piece on it. If the human
wants that start position, he clicks on that position. That means the next move is the computer's turn.
If the human does not want that start position, it is his turn to pick a next position.
User interface
Controls for this game:
- Refresh game button: sets counters to 0s and grid to default size.
- Drop down selection for choosing game size.
- Start game button (does not reset counters): use the current grid size,
make a clean game board, and put piece in start position.
- Scores showing numbers of: Computer wins, Human wins, Draws.
- Game board with clickable positions.
Just how smart is the computer?
This is programmer's choice. The only constraint is that the computer must make only legal moves.
Here are some possible ways for the computer to make a decision:
- Move the the first found (legal) spot (note, there will be at most 3 legal moves)
- Move to a random legal spot
- Move to the legal spot which is closest (in city-block distance) to the (red) goal. This heuristic
is a tiny bit of intelligence, but may backfire.
- Move to the legal spot which allows the most choices for green's move (also make backfire).
- Look ahead! (Artificial intelligence in game play)
Unspecified
All other facets are not specified. You will make appropriate design decisions.
Grade based on
- 50% programming
- 25% - Satisfying specs
- 8% - Good design: playability, aesthetics.
- 12% - Programming elegance
- 5% - Documentation
- 50% code walk through and on-the-fly modification