I need an idea to start writting a program

There is a n*n matrix in this matrix it's a mouse and a cheese in this matrix and some of the cell of the matrix is blocked (random) know we want to find out if the mouse could reach the cheese or not if so showing the way what is the best way to find it in the minimum time.
n and the place of mouse and cheese will be given by the user.
I know so so about programing please don't use professional tools.
thanks for your guide.


  • It sounds like you need a dynamically allocated two-dimensional matrix of "items", then randomize the output of the blocking cells. Then comes the tricky part of translating the matrix to some sort of graph, on which you can apply a shortest-path algorithm (Google for these unless you don't know one).
  • yes your right but it isn't important to find the shortest way just a way is enough I will thank you if you can tell me the way of realizing the way.
  • If you just want to find the way you need Prim's algorithm which is pretty much equally complex as a shortest path algo, in terms of programming.
  • I will thank you if you give me a brief explanation about what's Prim number and how would it help me
    thanks for your replies.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!