I have a grid with a start, finish, and some walls. Units take the shortest path (moving only up/down/left/right) from the start to the finish, without passing through walls.
The user is allowed to add as many extra walls as they want to change the path.
However, notice that no matter how many walls are added or where they're added, there are some squares that can never be part of the shortest path!
These squares can never be part of the shortest path!
I'm looking for a way to detect which squares can never be part of the shortest path.
The above cases are easy enough to find; but there are more complex cases. Consider:
In the above image, none of the squares with red dots can ever be part of the best path, because there's only one entrance to that area, and it's only two spaces wide. If it were three spaces wide, or if any one of the walls were removed, most of those squares could potentially be part of the best path.
I've been trying to figure out a way to detect cases like the above (mostly using min-cuts and flood-fills), but without success. Does anyone know of a way to solve this problem?