can anybody tell me the idea to solve this program, not the whole answer. I am a beginner.
Use a matrix represents an island surrounded by water. Two bridges lead out of
the island. A mouse is placed on the black square. Write a program to make the
mouse take a walk across the island. The mouse is allowed to travel one square
at a time, either horizontally or vertically. A random number from 1 through 4
should be used to decide which direction the mouse is to take. The mouse drowns
when he hits the water; he escapes when he enters a bridge. You may generate a
random number up to 100 times. If the mouse does not find his way by the
hundredth try, he will die of starvation. Restart the mouse in a reinitialized
array and go back and repeat the whole process. Count the number of times he
escapes, drowns, and starves.
Input File
1. First input line - the size of the array, including border of water and
bridges (not larger than 20 X 20)
2. Next N input lines-the rows of the two-dimensional array, where the
positions containing negative numbers represent the water, the positions in
the edge containing a 0 represent the bridges, the position containing a 1
represents the starting position of the mouse, and all other positions
contain 0s.
Output
1. A line stating whether the mouse escaped, drowned, or starved
2. A line showing the mouse's starting position and the position of the two
bridges
3. A map showing the frequency of the mouse's visits to each position