Maze
Problem
This is an interactive task where we simulated a Maze that is based on a grid. There are free tiles and walls (that occupy an entire tile). One is only given the status of the direct neighbors of the current tile that the user is on provided as 4 numbers (0 or 1) indicating wether the north, east, south and west tiles are either free or walls. Based on this the user should print a direction to go. When the exit is reached, the program will recieve the input "Exit" and should terminate.
Solution
With a recursive programm one can check all possible ways to go while remembering those fields that were already visited. This runs in linear time in regard to the number of fields of the maze.
Maze
Problem
This is an interactive task where we simulated a Maze that is based on a grid. There are free tiles and walls (that occupy an entire tile). One is only given the status of the direct neighbors of the current tile that the user is on provided as 4 numbers (
0or1) indicating wether the north, east, south and west tiles are either free or walls. Based on this the user should print a direction to go. When the exit is reached, the program will recieve the input "Exit" and should terminate.Solution
With a recursive programm one can check all possible ways to go while remembering those fields that were already visited. This runs in linear time in regard to the number of fields of the maze.