This is a Unity project I threw together to help me with a problem in Google's Foobar challenges called "Bringing a Gun to a Guard Fight".
In this problem, you and a target are in a rectangular room. You have a laser that can reflect off of the walls. You must find the maximum number of ways you can hit the target with the laser, given the following constraints:
- The laser only travels a certain distance before it expires.
- Both you and the target are fixed at positions on a grid within the room. The walls lay along this grid.
- You may only point the laser at positions on this grid (think of this problem from a birds-eye view).
I had a hard time visualizing the problem, so I wrote this program to help. There's a demo at joncole.me/pages/reflector, but to really play with it you'll want to download the source.
Please note that this does not contain the answer. I never ended up solving the problem (got the interview before I had to!) so it may not even be useful, but for those of you who find this repo trying to solve this problem, I hope it helps.