My 8 year old son Isaac, like many children his age, is a huge fan of the computer game Minecraft. Minecraft is a game of exploration and construction where every object in a randomly generated world is represented as a block. There are no explicit goals in the game, and the player has the freedom to decide how they are going to play and what they will build.

ComputerCraft and Lua

In the five years since it’s alpha release, Minecraft has grown a thriving developer community. Hundreds of third party modifications are available which significantly expand the capabilities of the vanilla game. ComputerCraft, an addon by Daniel Ratcliffe (@DanTwoHundred), adds computers, peripherals and turtles to Minecraft, which are programmed in the Lua programming language.

My reaction to discovering ComputerCraft, was it potentially could be a great platform for introducing children to computer programming. Minecraft is a familiar, fun environment for children, and Lua has many characteristics which make it a suitable first programming language. Compared to object-oriented languages like Java and Python, Lua has very minimal syntax, albeit not as minimal as Scheme. It provides a practical basis for learning imperative style programming without the complications of objects and classes. Lua however is flexible enough, that with it’s core data-types and meta-programming support, it can be extended to support more complex constructs if needed. Knowledge of Lua can easily be transferred to other languages like JavaScript, with which is shares some similarities.

The ComputerCraft Institute

Several weeks ago I began developing an in-game learning resource for primary school children that I’ve called The ComputerCraft Institute. The goal of the ComputerCraft Institute is to build a series of lessons within Minecraft that guide kids through the fundamentals of programming and using a text-based command shell. Each room within the ComputerCraft Institute contains a simple exercise designed to teach a particular concept.

ComputerCraft

Ideally children will have an instructor working through the exercises with them in-game, but there are instructions posted on monitors throughout the institute.

ComputerCraft

Turtles!

Since the 1970s, the Logo programming language has been used in education to teach programming fundamentals.

ComputerCraft turtles are similar to Logo turtles and can be programmed to move about in 3d space with functions such as:

turtle.forward()
turtle.back()
turtle.turnRight()
turtle.turnLeft()

Turtles are an ideal way to teach many programming concepts and are great for kids as they provide very tangible feedback. The exercise below teaches children basic imperative programming by having them guide a turtle through a simple maze. By the end of the exercise the kids understand how to use the CraftOS text editor, and both write and run a simple program.

ComputerCraft

Later exercises introduce the concept of loops, moving turtles in 3D space, digging, collecting resources and interacting with the world.

Resources

The ComputerCraft Institute world is an ongoing project and is available from Github. The first version of the ComputerCraft Institute required some additional mods available via the Feed the Beast modpack, but for the sake of simplicity, future versions will only have vanilla Minecraft and ComputerCraft as dependencies.

The following YouTube video is a narrated walkthrough of an earlier version of the ComputerCraft Institute:

Thanks

I’d like to thank Blair McBride (@theunfocused) of Mozilla and Tim Penhey (@howbazaar) of Canonical, two local Dunedin developers, for contributing Minecraft licenses to help run this workshop. Thanks also to Simon Clarke, Sue Graham and the children of room 3 at Kaikorai Primary. I had a great time teaching this workshop and was very impressed with the children’s enthusiasm and aptitude. I look forward to developing more resources and running more workshops in the future!

ComputerCraft



blog comments powered by Disqus

Published

08 July 2013

Tags