BBM203 Programming Lab. Assignment 1 solution

$25.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

AIM In this experiment you will have a chance to learn some data structures. You’re expected to implement a program that finds a solution path of the given maze.
PROBLEM Mazes have been an intriguing subject for many years. Experimental psychologists train rats to search mazes for food, and many a mystery novelist has used an English country garden maze as setting for a murder. We also interested in mazes since they present a nice application of matrices and stacks. You are going to develop a program that runs a maze. Although this program takes many false paths before it finds a correct one, once found it can correctly rerun the maze without taking any false paths.
In your program, the first issue that confronts us is the representation of the maze. The obvious choice is a two dimensional array in which zeros represents the open paths and ones the barriers. On the maze the capital letters denote doors and the small letters denote keys used for unlocking the doors. Same letters represent key-door pairs (a A, b B, etc). Your program needs to find a key to open the corresponding door. You should specify in the path.txt file which key is found. Figure-2 shows a simple maze. You are expected to implement a program that finds a solution among the possible paths. You should use these letters for moves in the path.txt file: E for East, W for West, N for North and S for South. The Start and Exit points should be on the first and last row on the maze, respectively. The letters S is used for Start and E for Exit (Our example shows that Start point is at top left, Exit is at bottom right). Let X marks the spot of our current location and then Figure-1 shows the possible moves from this position. So you have four directions of movements (except borders).
Figure-1. Allowable moves.
Some important issues:  Your program must find a possible solution path.  Maze size is not constant (but maximum 30 by 30).  Input Command: ./