Creating a maze solving algorithm in Java

You probably should module your program – as I can understand it, you are reading the maze from file and trying to solve it at the same time.

A better approach will be to split the program into 2 distinct parts:

  1. read the input file and create a matrix with all the data
  2. solve the maze from given matrix

Doing so will help you to build and test each part seperately, which will probably result in better, more reliable program.

Solving the maze could be done by a simple BFS, which is similar to what your algorithm originally suggested , which is a DFS

Leave a Comment