c# - Maze algorithm path finder -


I am trying to find a path to a maze, the code below, it seems that inside the recursive soul loop It goes but keep getting out of it, after the second condition if the condition is that what I am doing wrong here can someone help me please? The correct setting in the form of IM setting and wrong by default.

  recursive solution (0, 0); Public static int [,] Maze = {{0, 0, 0, 1}, {1, 1, 0, 0, 0, 1}, 0, 0, 0, 1, 0, 0}, {0 , 1, 1, 0, 0, 1}, {0, 1, 0, 0, 1,}, {0, 1, 0, 0, 0, 1}}; Public static boolean recursive solv (int row, int coal) {boolean [,] is = new boolean [6, 6]; Boolean [,] True Text = New Boolean [6, 6]; // If the solution of the maze (maze [row, cola] == 1 || these [row, cola]) {return false; } And if (line == 0 || line == 6 - 1 || tomorrow == 0] soft == 6 - 1) {right path [row, cola] = true; Back true; } And {were [row, color] = true; Recursive solvieve (line-1), (recursive solvieve (line-1), recursive solvieve (row + 1, cola) || recursive solvieve (line, cola-1) || recursive solvy (line, season 1)) {true text [Row, cola] = true; Back true; // ran successfully; This square is on the path} Other {return lie; }}}}}    

Your right here and the right path for the recursive solv function is local , Which means that every time you enter this function, arrays will be added to false (or random value).

First of all, try to make these arrays stable, and see if your problem always solves the lies.

In addition to this, you can start your search from the side of the maze rather than from the side (0,0 means that you are already out of the maze). If you want to start with 0,0, mark it as a starting point, and do not give it as a valid solution.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -