Lesson plan

Maze Algorithms

Students build mazes in Minecraft and program an Agent to navigate and solve them using sequences, loops, and wall-following branching algorithms.

Maze Algorithms
Ages
Ages 11-18
Essential question

How do we follow, describe, and represent a sequence of steps and decisions needed to solve simple problems?

Overview

In this lesson, students explore the fundamentals of algorithmic thinking by breaking navigation problems into discrete steps and logical decisions. Starting with basic sequential movement and progressing to generalizable logic, learners discover how computational rules guide problem-solving.

Learning objectives

By the end of this lesson students will be able to:

  • Break down navigation challenges into an orderly sequence of steps.
  • Apply loops to repeat instructions efficiently within the Agent's code.
  • Implement branching statements to guide the Agent based on environmental conditions.
  • Construct and test custom mazes to evaluate general maze-solving algorithms.

Blocks and items used in this lesson

Key vocabulary

Algorithm
A step-by-step set of instructions or rules used to solve a problem.
Sequence
The specific order in which instructions are executed.
Loop
A programming command that repeats a block of instructions.
Branching
A decision-making process using if/else logic to choose an action based on conditions.
Wall-Follower
An algorithm designed to solve mazes by continuously tracking along one wall.

Before class

Lesson sequence

  1. Phase 1: Unplugged and Rectangular Room Navigation

    Begin with an unplugged exercise where the teacher or a student acts as the agent while classmates provide spoken movement commands to navigate the classroom.

    Students then enter Minecraft, build a simple room with four walls and an exit, and write linear sequence code to guide the Agent along the perimeter and out the door. Extend the code so the Agent can exit even if placed at a random starting point.

  2. Phase 2: Maze Construction and Specific Solutions

    Students generate a new flat world and construct their own maze or labyrinth. Optionally, they can install a pressure plate wired to fireworks at the finish to signal success.

    Once built, students write code to navigate their specific layout, then swap worlds with a peer to test and solve each other's mazes.

  3. Phase 3: General Maze-Solving Algorithms

    Conduct an unplugged demonstration using an irregular room, such as a layout with an obstructing table, to analyze how to navigate unfamiliar spaces.

    Guide students to construct a general wall-following algorithm that checks conditions, such as walls to the left, right, or directly ahead, using if/else branching code.

  4. Phase 4: Testing and Further Investigation

    Students deploy their general wall-following algorithm against their own mazes and several peer mazes to evaluate its reliability.

    Conclude with an inquiry discussion on efficiency: consider whether mazes with center endpoints behave differently, whether one algorithm works for all layouts, and whether tracking visited paths improves speed.

Assessment: success criteria

  • The student can decompose a movement problem into an accurate sequence of steps.
  • The student demonstrates correct use of loops to handle repetitive movement.
  • The student successfully integrates branching (if/else) logic to respond to walls.
  • The student tests and modifies code to solve unfamiliar peer-created mazes.

Differentiation

Support

Allow students to focus on straight sequences in simple four-walled rooms before introducing branching logic.

Stretch

Have students adapt algorithms for mazes requiring start or end points in the center, or implement code that marks visited paths.

Knowledge check

5 questions to check understanding after the lesson. Tap an answer to see if it is right; the score appears at the end.

  1. 1What initial structure do students build to learn basic sequential code for the Agent?

  2. 2Which programming concept allows instructions to repeat without rewriting them?

  3. 3What algorithmic method do students develop to handle unfamiliar, general mazes?

  4. 4Which code structure helps the Agent make decisions based on whether a wall is present?

  5. 5What optional feature can students build to indicate that a maze has been completed?

Frequently Asked Questions

Does this lesson require a downloadable world file?

No special world download is required. Students build their testing rooms and mazes directly in a standard flat world.

How can teachers run the unplugged portion of the lesson?

A teacher or student can act as the agent while the class gives precise, step-by-step instructions to navigate around classroom furniture or along the room perimeter.

Can this computer science activity connect to other subjects?

Yes. The maze theme offers cross-curricular ties to literature and humanities by exploring why humans create puzzles and connecting to survival maze narratives.

Adapted from Maze Algorithms by Victorian Minecraft Innovators on Minecraft Education, last updated Apr 27, 2021. This classroom version, the timings and the quiz were written by 9Minecraft Education.

You May Also Like

9Minecraft Education is an independent teaching resource and is not affiliated with Mojang or Microsoft. Lesson plans here are our own classroom-ready adaptations; each one links to the original resource and credits its author. © 2026 9minecraft.net