Learn Python Using Minecraft

Minecraft is a gaming world. Or, if you like, a "sandbox." This is a three dimensional world in which characters do things, all sorts of things. The context for the world of Minecraft is very open ended. The player builds things, moves things, gets things, does things, in a way that makes any one gamer's game potentially very different from any other gamer's game.

You can buy Minecraft in various forms such as an XBox 360 version. It comes in Lego form (for example, this), and you can get a Minecraft cloud server version at Minecraft.net.

If you install Minecraft from Minecraft.net (about 30 bucks) and have Python 3, Java, the Minceraft Python API, and a Spigot Minecraft Server, you can program your own versions of the game using Python programming/scripting language.

But how? How do you do that?

Well, you can get Learn to Program with Minecraft: Transform Your World with the Power of Python. This book is intended to teach programming, in the Minecraft setting. The book is designed for kids 10 years and older, though I'm sure some younger kids can use it. Also, it must be admitted that a learning to program book like this may be most valuable for adults who are not coders but want to learn some coding, and happen to be gamers and like Minecraft.

The book, new on the market, provides excellent instructions for setting up all that stuff mentioned above. Everything should work on a Windows machine, on Mac OS X, and Linux.

The programming you do with this book is pretty sophisticated. You learn to create palaces, pyramids, to teleoport players around, to stack blocks, interact with Minecraft's chat feature, blow stuff up, cast spells, and replicate sections of the Minecraft countryside.

Here is what is interesting about this approach. Python programming is pretty basic, and pretty useful, but one has to do a lot of work to develop something slick and fancy and highly functional (counting working video games or interfaces as highly functional). But working with the existing Minecraft system, via the API, allows some relatively simple programming to produce impressive results. This is "Hello World" on steroids, at the very least.

Of all the diverse No Starch Press programming guides, this one may turn out to be the most effective, as a teaching tools, for that special case where a person is already interested in Minecraft and wants to learn Python.

Here is the Table of Contents:

Chapter 1: Setting Up for Your Adventure
Chapter 2: Teleporting with Variables
Chapter 3: Building Quickly and Traveling Far with Math
Chapter 4: Chatting with Strings
Chapter 5: Figuring Out What's True and False with Booleans
Chapter 6: Making Mini-Games with if Statements
Chapter 7: Dance Parties and Flower Parades with while Loops
Chapter 8: Functions Give You Superpowers
Chapter 9: Hitting Things with Lists and Dictionaries
Chapter 10: Minecraft Magic with for Loops
Chapter 11: Saving and Loading Buildings with Files and Modules
Chapter 12: Getting Classy with Object-Oriented Programming
Block ID Cheat Sheet

The author, Craig Richardson, is a teacher of Python, former high school computing science teacher, and has been involved with the Raspberry Pi Foundation.


More like this

How about learning to code in Java, since Minecraft was written in JAVA. Let's not resurrect the bad old days of Visual J++ etc.

By Patrice Boivin (not verified) on 01 Jan 2016 #permalink

I didn't think Python was the bad old days, though. Python may be the perfect language for this in that it is a semi-object oriented scripting language being used to control a big piece of software.

It has long been a good idea to choose the highest-level, latest-binding language (fast enough, supported enough),
This was known a long time ago.

See Languages, Levels, Libraries, and Longevity.

I don't think Python is bad old days either.

By John Mashey (not verified) on 01 Jan 2016 #permalink

Good timing Greg. A good friend has her students go into public schools (5th grade and up) and work on coding with kids. She's excited to check this out.

"But working with the existing Minecraft system, via the API, allows some relatively simple programming to produce impressive results. This is “Hello World” on steroids, at the very least"
This approach has a long history of being a Good Thing.
Princeton civil engineering ran a first programming course (on SGI workstations) where i/o and graphics wrappers let students focus on algorithms and get visualizations right away. I sat in on a class once in 1990s and it was terrific.

Back in the early 1970s, i wrote a macro package (XMACRO to do this for IBM S/360 assembler code, including simple commands to read or print, convert binary to/from decimal/hex, do subroutine linkage, etc ... for the same goal: let students get on with learning (in this case architecture and assembly programming) rather than struggling with masses of code to set up i/o.

By John Mashey (not verified) on 03 Jan 2016 #permalink

"But working with the existing Minecraft system, via the API, allows some relatively simple programming to produce impressive results. This is “Hello World” on steroids, at the very least."

Which is why, if I wanted to introduce someone to programming, I'd teach Javascript in a web browser. It's free, it's everywhere, it's an object-oriented environment, you can get visible stuff happening right away, and (unlike minecraft) it's commercially relevant.

By Paul Murray (not verified) on 06 Jan 2016 #permalink