This is similar to the Google and Airbnb thief evading sensors question some other users reported, but with a couple of twists.
Given an array representing a room, return true if the thief (T) can escape to the target tile (R) without alerting the guards, or false otherwise.
The room is filled with passable tiles (.), obstacles (#) and guards. Guards can only see in one direction (< see to their left, > see to their right, v see below them, and ^ see above them). Their eyesight is only interrupted by obstacles, not by other guards.
Tiles with obstacles cannot be traversed. Trying to traverse a tile with a guard immediately alerts the guard.
Examples:
[. . # . . v .]
[T . . . . . .]
[. . . . . . R]Answer: false
Explanation: T can never reach R without entering v's line of sight
[. . . # v < .]
[T # . # . ^ .]
[# # . . # . R]
[# # # . . . .]Answer: true
Explanation: The obstacles prevent the two guards (v and <) from ever seeing the thief.
I attempted to solve this by dfs by first rewriting the board to add obstacles along all guards eyesight paths. I couldn't get through all test cases, but I think it's because of a typo in one of my conditions regarding whether going down increases or decreases along the y axis.