This might be better than dijkstra, which requires a lot of pre-processing. https://www.geeksforgeeks.org/shortest-path-in-a-binary-maze/