Learning how to code with Minecraft as a non-computer-science student

🐟Curtis Chan FishSunSun
Curtis’s Digital Life
6 min readJun 3, 2019

--

▲ Education Edition features an agent where I learn how to program by writing command for it to place blocks.

Introduction

Last month (Apr 2019), Microsoft holds two seminars at my university. I am amazed by the classroom application of Minecraft, the sandbox game acquired by the company, and some of their educational research in my city Hong Kong. I am so interested in educational technologies thought my major is Psychology. Minecraft does engage the young learner in the classroom and unleashes their imagination in the unlimited virtual world.

Previously, I’ve reflected on how OneNote helped my undergraduate studies. This time, I turn to another useful but less familiar educational tool.

▲ Wearing a sweater, I am holding the new weapon Trident (Update Aquatic). I am following upward the two beacon beams to the sky, before the Microsoft logo which is built by my Agent.

▼ Great to see Microsoft Education love this.

I love Minecraft (I almost typed Microsoft, the two words look the same, haha) but I never think of its educational value. I gained some programming knowledge when trying this tool for myself. Minecraft is really interesting but handy tool for me, a non-computer-science student, to learn to code.

I wonder what can my agent build for me. Spontaneously, my first idea is to build the Microsoft logo by programming.

You can also download the source code at the end of this article. Also, don’t forget the behind the scene about my earliest code-writing failures.

Disclaimer: No compensation received from Microsoft or Mojang (the developer).

本文另有繁體中文(香港)版本。Traditional Chinese (Hong Kong) version of this article is also available here.

Table of Content

Introduction
1 Sketching on OneNote
2 Planning with Excel
3 Coding by MakeCode

3a Reusing functions
3B Creating a command
4 Give the command!
Final words
Behind the Scene
Source Code

▼ Pause screen in Minecraft Education Edition v1.9.2 on macOS.

1 Sketching on OneNote

The best way to learn is by doing it on own hand. In OneNote, I drafted a scene by Apple Pencil about how to put up the Microsoft logo on the grassland.

2 Planning with Excel

Before jumping into Minecraft, I have to plan what choice of blocks and their exact arrangement. I take the Microsoft logo as an example here. Excel is a good tool to create reference grids. I first select all the cells in the workbook and format them equally as a square.

By conditioning highlighting, I can just type the name initial of the color block I am going to use in Minecraft Education Edition. Now I have the blueprint. Then, how can I ask my agent to place the block on the graph respectively?

▲ Simple graphical planning for what color concrete blocks to be used.

▼ Conditional highlighting to swiftly indicate the exact placement.

3 Coding by MakeCode

When entered the world of Minecraft, type c on the Mac or tap the Agent icon on iPad to summon the Code Builder and the agent would be teleported in front of you.

3a Reusing functions

I first create two functions so as to teach my agent the procedure to build the Microsoft icon for me.

In the screenshot below, the right function checkLevel examines the agent’s working level. Depends on the level, if assign the partL and partR for respective color concrete blocks (#236, Official Minecraft Wiki).

The left function levelBuild tells the agent to place a block when it is moving forward. The agent would fly up and return to the initial x coordinate. Once a level is completed, the variable levelCurrent would append one for the function checkLevel conditional reassignment.

▲ Graphical representation of the two essential functions involved. A block is placed every time the agent moved.

▼ A more detail construction plan for the underlying code.

3B Creating a command

Then, I drag an “on chat command” out and name it run. In the command, the levelCurrent set up the for loop. There are seven levels but the agent can reuse the two functions for every level.

4 Give the command!

Previously surveyed, I decide to work here. Just type c or tape the message icon on the top middle, to display the chat interface. Input the preconfigured keyword, that is run, to announce my order to the agent.

▼ A video recording how my agent is building the Microsoft logo once it received my run command. Thanks, agent. You literally did the most of the“hard” work.

Final words: Hope more school can adopt such beneficial educational technologies like Minecraft

Programming literacy reflects so many universal skills. It trains our determination and fosters our problem-solving mindset. The code can further improve by an array. The possibility of coding is out of imagination.

I like both Psychology and Technology as both domains serve the same purpose, to improve we human’s well-being. I think life-long learning is brilliant as you educating yourself to embrace differences, to reduce stereotype, and to become flexible.

Behind the Scene

▲ Literally, the chaos behind the scene.

▼ I tried many ways to make such a “simple” icon. I am so frustrated to hit the bumpers multiple times. I have to refer the official manual and read over again before I understand how a specific syntax works.

▲ Ultimately, I got the insight to improve and deliver my correct command to my agent!!!

▼ [GIF] Watching the sunset with my agent who always stands by me.

▲ Selfie on Minecraft Education Edition

--

--

🐟Curtis Chan FishSunSun
Curtis’s Digital Life

讀心理學,鐘意科技同效率相關題材。A Psychology student is hooked on technologies and productivity. #地鐵迷 #非火車迷 #科幻 #電子化 #硬筆書法#手寫 #metro #digital #handwritten #calligraphy