Artificial intelligence - Part 1

Students collaboratively build mazes and write AI to solve their own mazes.

Learning objectives

Understand the importance of dividing up work, collaborating with others, designing before building, and adjusting designs based on new input.


Skill areas: Speaking and Listening, Collaboration, Roles

Ages: 11-13 yrs old

Grade level: 6th, 7th, and 8th

Guiding ideas

Follow rules for collegial discussions and decision-making, track progress toward specific goals and deadlines, and define individual roles as needed. Pose questions that connect the ideas of several speakers and respond to others’ questions and comments with relevant evidence, observations, and ideas. Acknowledge new information expressed by others, and, when warranted, qualify or justify their own views in light of the evidence presented.

Student activities

This activity requires students to have the Code Connection app open and running with their Minecraft Education Edition. Graph paper is also useful for this activity, but it is not necessary. This is the first lesson in a 2-part series.

This activity consists of 2 parts:

Building a maze

Have students get into groups of 2 or 3. If you are using graph paper, pass out the paper to each group. Have each group design a maze that is no bigger than 10 x 10 squares. Ensure that students have an entrance and an exit to their maze:

Example maze

Option 1

Have students create their maze in Minecraft by hand.

Option 2

Have students create their maze in Minecraft with code. For example, the code for the first two rows in the above maze would be:

player.onChat("createMaze", function () {
    positions.create(0, 0, 0),
    positions.create(10, 1, 10),
player.onChat("row1", function () {, positions.create(6, 0, 0)), positions.create(6, 1, 0))
player.onChat("row2", function () {, positions.create(4, 0, 1)), positions.create(4, 1, 1)), positions.create(5, 0, 1)), positions.create(5, 1, 1)), positions.create(6, 0, 1)), positions.create(6, 1, 1))

Solving the maze with AI

Have each group come up with a list of instructions to solve their maze. For example, these are steps to complete the maze coded in Option 2 above. It begins with the agent standing at the ENTRANCE looking into the maze:

  1. Forward 2
  2. Turn Right
  3. Forward 2
  4. Turn Left
  5. Forward 2
  6. Turn Left
  7. Forward 1
  8. Turn Right
  9. Forward 2

Have the students then code their agent to perform the actions. Ensure that the agent gets through their maze correctly.

OPTIONAL: Make it a competition! Who can design a maze that requires the most number of steps from an agent? The least number of steps?

Performance expectations

Intended outcomes:

  • This exercise can be completed in 1-3 class sessions, depending on the complexity of the mazes and whether students are designing algorithms.
  • Students should be able to recognize the importance of abstraction and algorithms.


Artificial Intelligence - Part 2