You just entered a room. Here's how it looks (you are the X):
|\ /| | \/ | | X | | | |----|
You challenge yourself to see if you can reach where you started by following the walls. You go right until you find a wall. Then, you turn clockwise until you are facing parallel to the wall.
For example, if you hit a
\ while going down, you will go up-left.
After that, you continue and repeat. In this visualisation, you will leave a trail. Here is how the example above would progress:
|\ /| | \/ | | Sxx| | X| |----|
You continue following this pattern.
|\ /| |X\/ | |xSxx| |xxxx| |----|
And yes, you reached the starting point.
|\ /| |x\/ | |xXxx| |xxxx| |----|
However, if there was a hole, you could get lost:
|\ /| | \/ | | SxxX | | |----|
As input, in any reasonable format, your program must recieve the room you are in, which consists of walls (|/-), spaces and your starting point (the X) (the starting direction is always right).
As output, your program needs to output a truthy or falsy value representing if you got to your starting point.
The format here is input -> output (reason for being false).
/-\ |X| -> true \-/
X -> false (hits boundary)
X | -> true \
X | - | -> false (trapped in endless loop) | - -
This is code-golf, so the program with the least bytes wins!