Let's say you have a grid like this (made randomly):
Now let's say you have a car starting randomly from one of the while boxes, what would be the shortest path to go through each one of the white boxes? You can visit each white box as many times as you want and can't jump over the black boxes. The black boxes are like walls. In simple words you can move from white box to white box only.
You can move in any direction, even diagonally.
Two subquestions:
- Assume you know the position of all black boxes before moving.
- Assume you only know the position of a black box when you are in a white box adjacent to it.