Lesson · with Servo · Architect rank

If Then That

Teach the Agent to make a decision: if something blocks the way, turn; otherwise, keep moving. That is how a maze runner works.

You need

  • Minecraft Education
  • A new flat creative world
  • The printable mission sheet (optional)

Steps

  1. Build a tiny maze

    Place a few walls by hand to make a short hallway with two corners.

  2. Ask a question

    Make a command called explore. Add 'repeat 30 times'. Inside it add an 'if … else' block from Logic.

  3. Use the Agent's sensor

    For the condition use 'agent detect block forward'. If true: 'agent turn right'. Else: 'agent move forward by 1'.

  4. Test and fix

    Run explore. If the Agent gets stuck, ask: what does it do at a dead end? Try adding a second check.

Build task

Trap Trial

Design a hallway the Agent can solve with your if/else program, then challenge a friend's program to solve it.

Finish line: The Agent reaches the end of your hallway without you steering.

Check your understanding

1. In 'if agent detect block forward then turn right else move forward', what happens when the path is clear?
2. A conditional lets a program…
3. Your Agent spins in a corner forever. A good debugging question is:
Guest mode: your result is saved on this device only.