40. Escape Maze

Johann fell asleep in his chair without meaning to, one boot still muddy from the street, one hand hanging loose beside an extinguished candle. The common room had long since gone quiet. Snow pressed softly against the windowpanes, and the last warmth of the stove had begun to fail.

In his sleep he found himself already walking.

The place through which he moved was neither corridor nor forest, though it borrowed something from both. Narrow passages opened into darker turnings. Doors stood where no walls had seemed to be a moment before. Some yielded. Others would not. Here and there, in the dimness, small keys lay waiting— plain, cold, and oddly necessary.

Johann tried at first to meet the dream in his usual manner: quickly, confidently, with the offended impatience of a man certain that no maze had the right to delay him.

But each bold turning brought him only to another closure. A locked door. A passage that returned him to where he had already been. A threshold that seemed almost to open, only to refuse him again.

„Ridiculous,“ he muttered into the dream. „If this is allegory, it might at least have the courtesy to be shorter.“

Yet the maze did not care for wit. It answered only to conditions.

Soon his irritation became something less theatrical and more honest. He wanted to leave. He could not.

It was then that the feeling came over him— not of being watched, but of being accompanied.

Mihkel was nowhere before him. No voice called his name. No hand touched his shoulder. And yet Johann became certain, with the peculiar certainty that belongs only to dreams, that Mihkel was somehow present.

Not inside the maze, perhaps. Not as another wanderer. But beyond it. Around it. As though he could see the whole from above while Johann stumbled within its turns.

Then came the guidance. A hesitation before the wrong passage. A sudden conviction that he must turn back. An inexplicable pull toward some overlooked key he had taken for a useless trinket. And when he obeyed that invisible pressure, doors that had seemed final gave way at last.

Johann moved faster now, not because he understood, but because he trusted the pattern he could not see.

Still the way did not fully release him. The last turns blurred. The dark shifted. He felt, all at once, that he stood very near escape and very far from it.

On the input tape, you'll get a one-dimensional maze. Your task is to determine whether the escape 0 is reachable from the start position @, and output Y if it is, or N otherwise.

Symbols

  • @ is the start position.
  • 0 is the escape.
  • - is an empty maze cell. It is written as - rather than _ so you can distinguish cells inside the maze from blank tape outside the maze.
  • a, b, c are keys.
  • A, B, C are doors.

Rules

  • You may move one cell left or right at a time.
  • Stepping on a key collects it permanently.
  • You may pass through door A only if you have collected key a, and similarly for other letters.
  • You may revisit cells freely.
  • You only need one valid path to 0; unopened doors elsewhere do not matter.

For example, if the input tape is a---@-A--0, the output tape should be Y: first go left from @ to collect a, then return right and pass through A to reach 0.

Thanks to kyroos for suggesting this puzzle idea!

Sign in to submit your solution.

Quest leaderboard
Discuss it on Reddit or Discord
This was the last quest for now.
Get updates about new quests by subscribing to the social media channels or RSS