In this problem you will solve the “Rat in a maze problem” (Lecture 12), using Stacks and
The maze is given as a 2D array, where '0's are squares the rat can move to; '1's represent the
squares where the rat cannot move to. The coordinates of the square at the top left corner are
(0,0). The coordinates of the square ate the bottom right corner are (14,12). The positive direction
of x axis is to the right, and the positive direction of y axis is down.
You have to implement these three methods:
searchStack(int fromX,int fromY,int toX,int toY) ,
searchQueue(int fromX,int fromY,int toX,int toY) ,
searchStackSmart(int fromX,int fromY,int toX,int toY)
In all above methods, the problem is to find a path from (fromX, fromY) point to (toX, toY).
Each method has its own strategy:
A rat that always attempts to move in a specific order: right, down, left and up.
This method should be implemented using a stack.
On a given square, the rat reproduces, and up to four rats take one step away from
the current square, each rat in a different direction. Each of these rats will choose one direction: