This page shows you how to build a wall using code in Minecraft Educational Edition (M:E:E). You will of course need an account setup by your school so if you don’t have those I can’t really help.

Step 1: Press ‘C’ to start the code builder

Once you have logged in and joined or created a world we can then start coding. In M:E:E you press ‘C’ (for code) to start the code builder.

Step 2: Click ‘New project’

If you are starting some new code you should create a new project by clicking the button in the image. Once you have started coding you will automatically skip this window. If you are continuing some code you built earlier then you should find it listed here. Make sure you give your projects logical names so you can find it easier next time.

Step 3: Enter a project name and click Create

When you have lots of code projects it will be important to give it a good name so you can quickly find it again later. Even if this is your first project you should get into the habit of naming things well.

Step 4: New project contains 2 blocks – what are they?

This is how a new project will look. There are 2 default blocks added. The ‘on start’ block will run code whenever you close the code builder. The ‘on chat command’ block is where we’ll write our wall building code. Notice that the default chat command name is ‘run’. This is what you must type into the chat command window to start your code.

Step 5: Name your chat command

The name of your command should be short and logical. Since the code will build a wall I suggest calling it ‘wall’. The name should not contain spaces or any punctuation – just use lowercase letters and numbers. You will be typing it in a lot when you test your code so don’t make it too long or complicated.

Step 6: Code to build first layer of wall

Ok, time to get coding. Examine the code in the picture and locate the same blocks to add into your code builder. Check that the directions and the numbers are also the same. You can change these later to experiment, but for now just follow the example. Once you have checked that you have all the blocks in the right positions and with the same information, then you are ready to do your first test.

Step 7: Close the code builder

To test your code you must first close the code builder either by clicking the play button (triangle) in the bottom right corner or the close button (x) in the top right corner.  You can also press [Esc]. This will run the code in the ‘on start’ block and take you to the normal Minecraft game screen.










Step 8: Press ‘T’ and enter chat command

Now you press ‘T’ (talk) to enter the chat window. Highlight the box at the bottom with your mouse then type in the command (e.g. wall) and press [enter]. The chat window should close, your agent should magically appear and then…

Step 9: Test number 1 result – uh oh!

Don’t be disappointed if the agent appeared and moved like we told it to, but didn’t place any blocks. Why? We didn’t give it any. We couldn’t give it any because this is the first time we’ve seen it.

Step 10: Open the agents’ inventory

In order to give your agent some blocks you right click on it to open up the inventory window. This allows you to see your own inventory plus the agents inventory.

Step 11: Give agent blocks in slot 1

You must now move some blocks from your inventory to the first slot (top left) of the agents’ inventory. If you don’t have any blocks then you need to get some. Ask the teacher and they can run a command to give everyone blocks if the game mode is survival. Ok, time to test again. Go to the chat command window (press T) and type in the command name (wall) and press [Enter].

Step 12: Test result 2 – success?

Success at last. Doesn’t it feel magical?! If it didn’t work, go back and check the code from the previous steps. Also check the name of your chat command. Did you spell the command name correctly. Did you go to the chat window (T), enter the command and press [Enter].

Ok, it’s not much of a wall yet, but we’ve just started the fun part. You will notice that the agent is standing on the last block of the wall. We want to build many layers but first we must position the agent to build the 2nd layer.

Step 13: Move back 4 and up 1

By adding the 2 red blocks outside the first repeat loop we will move back to the start of the wall (4 blocks) and then up one block – perfectly positioned to start the 2nd layer. Ok, time for test number 2.

Step 14: Test number 3 result – what??

Did you think we were already finished? We only added 2 extra blocks to move the agent to the start of the wall and up 1 block. If your agent doesn’t do this then you might have skipped the last bit of code.

Success again! Notice how we move back the same number of blocks as in the repeat? It makes sense as we just built the first layer by moving forward 4 times and placing blocks and now we move backwards 4 spaces. If you want to make the wall longer remember to change both numbers to the same value (remember that for the challenges at the end).

Step 15: Code to add multiple layers to the wall

The next block of code is another ‘repeat’ loop. You must carefully place it so that it contains the first repeat block and the last 2 red blocks we added. This ‘outer’ loop will repeat our code 4 times to build a wall 4 blocks high and 4 blocks long. Time for the next test.

Step 16: Test number 4 result – wow!

Ok, hopefully you remember how to enter the chat command by now (step 8). Some common problems are that the agent has run out of blocks (see step 10) or you’ve put some of the code in the wrong position (see step 15). If you followed the instructions carefully you should end up with a 4 x 4 wall that looks something like the picture. Well done! If it doesn’t then review your code and compare it to the previous steps. Time for a challenge!

Step 17: Complete Challenge 1 – Make the wall taller

Before you start the challenge you might want to add the teleport block to the ‘on start’ event. This will make sure you can reach your agent in case it’s too high and you need to give it more blocks.

OK, so the first challenge is to make the wall taller. You should only need to change 1 number to complete this task. Hint: What did the last block of code we added do again? Here’s a picture of the final code. Remember, this code built a wall that was 4 blocks long and 4 blocks high. The outer repeat loop built the multiple layers. The inside loop built each layer.

If you changed the code correctly, your wall should now be taller.

Step 18: Complete Challenge 2 – Make the wall  longer

The next challenge is to make the wall longer. To do this you will need to change 2 numbers in the code. If you only change 1 of them you might get a staircase like structure (which is fun anyway).

Hint: look at the first 2 coding steps – the first moved the agent forward to build the first layer and the 2nd moved the agent back to the start of the wall.

Now your wall should be taller and longer. Ready for the final challenge?

Step 19: Complete Challenge 3 – Make 4 walls in a square

The final challenge is to build 4 walls in a square. Now you will have to add 2 blocks and remove 1. The first addition is yet another repeat loop (hint: 4) and you have to figure out the other one yourself. The agent should build 1 layer of the square and then multiple layers. It’s your turn (another hint) to experiment now.

If for some reason you’ve lost all your code or cannot enter it in you can also import the code that I’ve written by importing the code from this link: