I sort of understand the concept of pathfinding and how a program looks for point B from point A in the most efficient manner and vaguely familiar with the concept of A*. But what if, instead of trying to find a way through the maze, you're trying to find the longest corridor in closed off maze where the corridor can not be on a diagonal.
Here's my example maze:
1 1 0 1
0 0 1 1
1 0 1 0
1 0 1 0
If using 1's as the allowed path and 0's as an invalid path, the longest path is 5 with the coordinates being (0,3), (1,2), (1,3), (2,2), (3,2).
How would I find this information recursively?
I've been racking my brain on how to start from (0,0) and go up, down, left, right to see if those are possible moves, but any version I come up with encounters duplicates and repeated counts.