Labyrinth solver