Question: I need help writing this for Java language This is one of the classicl problems of computer science. There is a rat trapped in a

I need help writing this for Java language
 I need help writing this for Java language This is one
of the classicl problems of computer science. There is a rat trapped

This is one of the classicl problems of computer science. There is a rat trapped in a maze. There are multiple paths in the maze from the starting point to the ending point. There is some cheese at the exit. The rat starts from the entrance of the maze and wants to get to the cheese. This problem can be attacked as follows: Have an m m matrix which represents the maze. For the sake of simplifying the implementation, have a boundary around your matrix and fill it up with all ones. This is so that you know when the rat is trying to go out of the boundary of the maze. In the real world, the rat would know not to go out of the maze, but hey! So, initially the matrix (I mean, the maze) would be something like (the ones represent the "extra" boundary we have added). The ones inside specify the obstacles. 100000000000000000001 100000010000000000001 100000010000000000001 100000000100001000001 100001000010000000001 100000000100000000001 100000000000000000001 The rat can move in four directions at any point in time (well, right, left, up, down). Please note that the rat can't move diagonally. Imagine a real maze and not a matrix, In matrix language

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!