2. The First Corner
Maze · Intelligence Studio
Extend the straight-line brain to turn at corners and settle on the exit.
Scenario
The corridor turns a corner. The robot knows how to walk forward, but gets stuck when blocked.
Problem statement
The corridor ends at a 90-degree corner.
Your robot already knows how to step forward when the path is clear, but when it encounters a wall, that rule stops matching and the robot stops moving.
Add a new rule to handle walls: when a wall appears ahead, turn right so the robot can face the open path.
The starter brain has a rule for walking forward. When it reaches a wall, it stops because no rule matches `wallAhead`.
Place a new wall-handling rule above the forward-stepping rule. Remember: rules are checked from top to bottom, so arrival (`atGoal`) should always come first.
What this teaches
Combine clear-path movement and wall turning to navigate around obstacles.
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.
Task progress & pass contractThe exact requirements used to judge this visible run⌄
- Reach the goal and settlenot run
reached - Finish within 20 ticksbonusnot run
reached && ticks <= 20
Press Apply & Run to load your brain and start the simulation.