Pascal Worked Example: Maze Game

From SwinBrain

This sample walks you through the implementation of a small maze game. The game allows a player to navigate through a maze.

Problem

Implement a console based maze game. The maze can be displayed on a single screen and the player can move (using the arrow keys) around the maze.

Design Ideas

Data: The data for this program can be stored in a two dimensional array. Each element in the array can indicate if there is a wall at that X, Y location (can be stored using a Boolean value).

Structure: The structure will evolve over the various iterations. It will most likely involve the following steps:

  • Load map from file
  • Display Maze
  • Display Player Location
  • Clear Player Location
  • Read Keyboard input
  • Update location

Iterations

This game was implemented using a number of iterations.

[edit]Maze Game: Overview | Iteration 1 | Iteration 2 | Iteration 3
Sample Code » C | C++ | .NET | Pascal | Perl | T-Sql | XHTML | Python | others to come