~/boss / haunted-halls

Cycle detection (three colours)

The Haunted Halls

Some halls loop forever. Unroll your string, walk every door, and mark the safe rooms.

Loading the fight…

How to beat it

Walk through a door and your string follows you: the rooms it runs through are gray. A dead end, or a room whose doors all lead to safe rooms, is safe: wind the string back one room. Walk into a room your string already runs through and you've found a loop: every room on the string can reach it, so they're all trapped. A door into a trapped room traps you too.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/find-eventual-safe-states there. Sign in with your email to keep your progress on every device.

More bosses

esc