←
Build the decisionSaved automatically
Easy · Grade 26. The Branching Maze

Solve the 11x11 Branching Maze by navigating junctions, dead ends, and winding corridors.

Scenario

The maze contains dead ends and multiple junctions. Unordered rules cause infinite loops.

Problem statement

You face an 11x11 maze filled with open junctions, misleading dead ends, and winding corridors.

The robot only senses relative local facts at each tick: wallAhead, wallLeft, wallRight, and atGoal.

Your challenge is to solve the maze using a wall-following strategy. By handling specific junction and dead-end situations before general movement fallbacks, your robot can systematically escape any maze layout!

The starting brain has primitive actions and no rules.

Build your rule hierarchy: 1) WHEN atGoal -> DO hold, 2) check preferred openings, 3) step forward when clear, 4) turn at walls, and 5) fallback when fully blocked.

What this teaches

Master top-to-bottom rule ordering: prioritize arrival, handle openings/junctions, manage blocked corridors, and escape dead ends.

Scroll down to build and test your solution.

Active controller

Apply & Run executes only the selected controller.

How a rule works

A rule has two parts:

WHEN <something is true> → DO <this action>

  • WHEN is a question about what is happening right now. For example: "Is it raining?" or "Is there a wall ahead?"
  • DO is what happens when the answer is yes.
  • The simulation runs one step at a time.
  • On each step, the rules are checked from top to bottom.
  • The first rule that is true wins. The rules below it are skipped for that step.
  • To change which rule wins, move it up or down the list.
  • If no rule is true, nothing happens on that step.
  • Some actions have more than one step, like "turn right, then move". You build these in the Functions tab.
  • Once a multi-step action starts, it finishes all its steps before the rules are checked again. It only stops early if the next step is not safe.
See an example

Two rules for deciding about an umbrella:

1  WHEN isRaining  → take an umbrella
2  WHEN always     → leave the umbrella at home
  • It is raining. Rule 1 is true, so you take an umbrella. Rule 2 is skipped.
  • It is sunny. Rule 1 is false, so rule 2 is checked next. Rule 2 is always true, so you leave the umbrella at home.
  • Order matters. If rule 2 were on top, it would be true every day, and you would never take an umbrella.

Rule folders

Categorise cards without changing their global execution order.

No rules yet. Nothing will happen until you add at least one rule.