

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A programming assignment where students are required to write a program to solve a maze represented as a two-dimensional array of characters. An example data structure, input format, and sub-procedures for loading, displaying, and solving the maze. The assignment includes instructions for displaying the maze array and finding a path through the maze.
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


TYPE Mazetype IS ARRAY(1..50,1..50) OF Character; TYPE Position IS RECORD -- a structured data type to hold the row Row : Integer; -- and column of a position in the maze Col : Integer; END RECORD; Maze : Mazetype; -- rectangular array of size 50 x 50 Nrow,Ncol : Integer; -- actual size of maze array currently loaded Start : Position; -- start position in maze Finish : Position; -- finish or goal position in maze
PROCEDURE Solve_Maze IS BEGIN Curpos:=Start; LOOP Record_Current_Position(Curpos); EXIT WHEN Curpos=Finish; Choose_Direction_To_Move(Dir); Move(Dir,Curpos); END LOOP; END Solve_Maze;
BEGIN --main program Load_Maze; Show_Maze; Solve_Maze; Show_Path; END Amaze;