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.
- Iteration 1: Load the maze from file