CASE STUDY 3
Rat in a Maze
Consider the maze given below. A white block represents free space, and a grey block represents a blocked space.
Goal: Print the path from 0,0 to n-1, n-1 if exists or print -1;
Input: The binary matrix representation of the above maze (a) is given as:
{1, 0, 0, 0}
{1, 0, 0, 0}
{1, 1, 1, 1}
{0, 0, 0, 1}
Output: The highlighted lines in (b) show the path to reach the destination from the source.
Explanation: A maze is an NN binary matrix of blocks. The rat has to start from the upper left most block, i.e., maze[0][0] ...
Get Artificial Intelligence: Beyond Classical AI now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.