Excerpt from Description of Exercise

Objective: Build an interesting game using much of what you have learned so far.

For this assignment, we would like you to implement a game designed to somewhat resemble the game named Glinx that can be found at http://www.gamehouse.com.

Like the original game, our game is played on a grid. The grid is filled with tokens of different colors. Two or more tokens of the same color can be linked together to form a path as long as the path does not cross itself and does not pass through any cell containing a token of a different color. Once a group of tokens have been linked to form such a path, they can be removed from the game board. The goal of the game is to remove all the tokens from the grid using as few paths as possible.

A sample of what the game display should look like as you play this game is shown below.

A player forms a path by dragging the mouse from one grid cell to another along the desired path. To start a new path, the player should point at a cell containing a token that is not already part of a path and depress the mouse button. Then, each time the player drags the mouse into a new cell, the program will either add a cell to the path or remove the last cell from the path. A new cell will be added to the path if the mouse is dragged into a cell that

  1. is not already part of the path,
  2. is adjacent to the last cell added to the path, and
  3. is either empty or contains a token of the right color.
      The last cell will be removed from the path if the cell into which the mouse has been dragged was the next to last cell in the current path. This will enable the user undo a path by backing up along it.

      Once the player is happy with the path drawn, all of the pieces in the path can be removed from the grid by clicking once on the last cell of the path as long as this cell contains a token.

Handouts Describing the Exercise

Student Resources for Lab Exercise

Sample solutions