I understand the concept of finding a path and how the program searches for point B from point A in the most efficient way and is vaguely familiar with the concept of A *. But what if, instead of trying to find a path through the maze, you are trying to find the longest corridor in a closed labyrinth where the corridor cannot be diagonally.
Here is my example of a maze:
1 1 0 1
0 0 1 1
1 0 1 0
1 0 1 0
If you use 1 as a valid path and 0 as an invalid path, the longest path is 5 with coordinates (0.3), (1.2), (1.3), (2.2), (3.2).
How can I find this information recursively?
I'm trying to figure out how to start from (0,0) and go up, down, left, right, to see if these movements are possible, but in any version I come across duplicates and recounts.