Image for post
Image for post

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

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

Introduction

ast 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.

Image for post
Image for post

▲ 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.

Image for post
Image for post

1 Sketching on OneNote

he 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.

Image for post
Image for post

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.

Image for post
Image for post

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?

Image for post

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

▼ Conditional highlighting to swiftly indicate the exact placement.

Image for post
Image for post

3 Coding by MakeCode

hen 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.

Image for post
Image for post

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.

Image for post
Image for post

▲ 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.

Image for post
Image for post

3B Creating a command

hen, 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.

Image for post
Image for post

4 Give the command!

reviously 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

rogramming 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.

Image for post
Image for post

Behind the Scene

Image for post
Image for post

▲ 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.

Image for post
Image for post
Image for post
Image for post

▲ 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.

Image for post
Image for post

▲ Selfie on Minecraft Education Edition

Curtis’s Digital Life

Reflection of many techniques, tips that increase one’s…

🐟Curtis Chan Chun Tsong

Written by

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

Curtis’s Digital Life

Reflection of many techniques, tips that increase one’s value in digital era, by Curtis Chan

🐟Curtis Chan Chun Tsong

Written by

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

Curtis’s Digital Life

Reflection of many techniques, tips that increase one’s value in digital era, by Curtis Chan

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store