Learn to Code by Programming Robots in Minecraft!

You've mined for diamonds, crafted dozens of tools, and built all sorts of structures—but what if you could program robots to do all of that for you in a fraction of the time?

In Coding with Minecraft, you'll create a virtual robot army with Lua, a programming language used by professional game developers. Step-by-step coding projects will show you how to write programs that automatically dig mines, collect materials, craft items, and build anything that you can imagine. Along the way, you'll explore key computer science concepts like data types, functions, variables, and more.

Coding with Minecraft is available under a Creative Commons license, and is free to read online.

Installation Instructions Update for Minecraft 1.16

The instructions in the book only work for Minecraft 1.8. Instead of using the ATLauncher program to add the ComputerCraft mod to Minecraft, the current version of Minecraft uses Forge. Updated instructions are found in this blog post, Installing the ComputerCraft Mod for Minecraft 1.16 (and later), and a video of installing Forge and the mod are on YouTube.

Download the files for the book.

Front Matter

Table of Contents


Chapter 1: Getting Started with ComputerCraft

Chapter 2: Programming Basics

Chapter 3: Talking to Your Turtle

Chapter 4: Programming Turtles to Dance

Chapter 5: Making a Better Dancer

Chapter 6: Programming a Robot Lumberjack

Chapter 7: Creating Modules to Reuse Your Code

Chapter 8: Running an Automated Tree Farm

Chapter 9: Building a Cobblestone Generator

Chapter 10: Making a Stone Brick Factory

Chapter 11: Constructing Walls

Chapter 12: Constructing Rooms

Chapter 13: Constructing Floors

Chapter 14: Programming a Robotic Farm

Chapter 15: Programming a Staircase Miner

Function Reference

Name ID Reference

Receive a Free Review Copy

If you'd like to receive a free print copy of Coding with Minecraft, please fill out the form at https://goo.gl/forms/pk6UYiMQhDQsXZKY2. Please specify you want "Coding with Minecraft". You'll receive a free ebook to read, and upon posting a review to Amazon, you will receive a complementary print review copy of the book. (UPDATE: There's been a large amount of interest, and I can't guarantee you'll get a print book. However, I can definitely send you an ebook to review.)

To demonstrate that you will be able to write a review, please send me a link to an Amazon, Goodreads, or Powells review you have written before. If you haven't written an Amazon review before, please explicitly tell me in your email you have an Amazon account and can post reviews. Also, please include the word "walrus" in the subject of your email so I know you read this. I'm happy to send out books to reviewers, but I can only respond to serious inquiries from folks who have read these instructions.

Please post an honest review. You will receive a print book no matter what your rating is. The only requirements are that the review be a minimum of 100 words, you must live within the United States (due to shipping costs), that you must have purchased $50 of products off Amazon (to be eligible to post Amazon reviews), and that you email me first before writing the review.