The maze is a 2D Grid of known width and height.
it's composed of squares: a Wall or a room.
You cannot walk into walls.
from each room you can only get to adjacent rooms. ( you can't teleport)
You can only know if a given square is wall if you are or were in a room adjacent to it.
You start at room (0,1)
You need to visit all rooms that are reachable in $k$ steps from the start. Visit as in physically walk to.
The performance of the algorithm is measured in terms of Total distance walked.
Naive approach: depth first search, but make sure to only revisit a node, if distance Left when last visited is less than current distance - 1.
what are better Algorithms to solve this problem?