All lesson plans

First Steps in Coding with Code Builder

Coding · Grades 3-9

Code Builder brings block based programming (MakeCode) into Minecraft. Students write code that an in game agent runs, turning loops and conditionals into visible actions.

What this lesson teaches

The hardest part of teaching programming to beginners is that the effect of code is usually hidden inside the machine. Code Builder removes that gap. Students drag blocks together in MakeCode, press a key, and an in-game robot called the agent immediately carries out the instruction in the world they are standing in. A sequence of three blocks becomes three visible movements; a loop becomes the agent repeating an action you can watch and count. Because the result is a thing happening in front of them rather than a number printed to a console, the link between an instruction and its effect is impossible to miss, which is the foundation every later concept is built on.

The three core ideas of structured programming, sequence, iteration and selection, all appear in a tangible form. Sequence is just the order the agent does things, and getting it wrong produces an obviously wrong result, which teaches that order matters without a lecture. A repeat loop is introduced as the answer to a real annoyance: rather than dragging the same move block ten times, you wrap one block in a loop and the agent does it ten times, so students feel why iteration exists before they are given the word for it. An if statement gives the agent a decision, place a block only if the space ahead is empty, so selection is framed as letting the program respond to the world rather than following a fixed script.

Code Builder is also a deliberate on-ramp from blocks to text. The same program can be flipped from the MakeCode block view to a JavaScript or Python view, so a loop a student built by dragging shows up as the equivalent lines of real code. This lets a class start where everyone can succeed, with blocks, and gives the students who are ready a low-friction step toward text-based programming without changing tools or starting a new project. The agent, the loops and the conditionals are the same; only the representation changes.

Learning objectives

By the end of the lesson, students should be able to:

Materials

How to run it in Minecraft

Code Builder is opened in game by pressing C, which launches the MakeCode block editor connected to the world. Confirm beforehand that students are on Minecraft Education Edition, where Code Builder and the agent are built in. Use Creative mode so blocks are unlimited and a failed program costs nothing but a quick undo. Start the whole class on the same first task, move the agent one block forward, so everyone succeeds and sees the connect-code-to-action loop before branching out. Teach the repeat loop by first asking students to build a five-block wall the slow way, with five separate move-and-place blocks, then showing the loop that does the same thing, so the loop solves a problem they have personally felt. Keep tasks small and incremental; each new block type should be introduced against a concrete goal. Encourage students who finish early to switch the editor to the JavaScript or Python view and read their own program as text. Classroom Mode lets you keep the group synchronised and reset the agent for anyone who gets stuck.

Steps

  1. Open Code Builder and connect MakeCode. Move the agent forward with a single block.
  2. Use a repeat loop to make the agent build a 5 block wall.
  3. Add a turn so the agent builds a square.
  4. Introduce an if statement: place a block only if the space ahead is empty.
  5. Challenge: have the agent plant a row of crops using a loop.

Grade level

Works across grades 3 to 9, roughly ages 8 to 15, because the block interface scales. Younger students stay in the block view and focus on sequence and loops; older students take on conditionals, nested loops and the transition to the JavaScript or Python text view.

Discussion questions

Variations

Older students convert the same logic to the JavaScript tab in MakeCode to see text based code.

Related lessons

Frequently asked questions

What is the agent?

The agent is a programmable robot character in Minecraft Education Edition that carries out the code a student writes in Code Builder. It can move, turn, place and break blocks, and detect what is around it. Because the agent acts in the world the student is standing in, every line of code produces a visible result, which is what makes it such a good first programming tool.

Do students need to know how to type code already?

No. Code Builder uses MakeCode, a drag-and-drop block editor, so beginners build programs without typing syntax. Blocks snap together and cannot create a spelling mistake, so the focus stays on logic. When students are ready, the same program can be switched to a JavaScript or Python text view, but that is an optional next step, not a starting requirement.

Which programming languages does Code Builder support?

Code Builder is built around MakeCode blocks and can display the same program as JavaScript or Python. Some setups also offer a tabbed Tynker or Python experience. For an introductory lesson, blocks are the right entry point, with the text views available for students who want to see the real code behind their blocks.

What grade level is this for?

It suits grades 3 to 9 because the block interface scales with the learner. Younger students concentrate on sequences and simple loops, while older students take on conditionals, nested loops and the move to text-based code, all within the same activity.

How do I open Code Builder?

Press the C key while in a Minecraft Education Edition world to open Code Builder and the connected MakeCode editor. Code Builder and the agent are part of Education Edition; they are not available in Java or standard Bedrock, so make sure your class is on the right version first.