Category Archives: minecraft

Minecraft and Python — text-based coding!

For my first foray into text-based coding, I recently moved to coding Minecraft with Python. Or “Mython”, as I affectionately call it. I’ve tried other things, like Small Basic and GameMaker (GML, their text language) and, while students can learn from any platform, I felt Minecraft offered more bang for the buck.

The engagement factor is off the charts for Minecraft. I’d be crazy not to try to tap into that. So I launched a year-long exploration of various coding environments for Minecraft(you can see my now somewhat-dated presentation from CSTA 2015 here). My conclusion was that Python offered the best entry-point, and the amount of support available tipped the scales for me. Here’s why:

It’s fairly easy to install and available on Mac, PC, Linux, and Raspberry Pi. For the first three, you’ll need Minecraft, Python, and an implementation of a Bukkit server so that each student can run her own instance of Minecraft. She will also need a Minecraft license (which does cost $27US, but many kids have one already). The beauty of Mython on the Raspberry Pi is twofold — no need to purchase a Minecraft license, since Mojang donated an early version of Minecraft to the Raspberry Pi Foundation. And the Bukkit server is not needed. So there are two big steps you can skip, if you’ve got a set of Raspberry Pi’s (see my chapter on RPi for many reasons why you should consider this).

So why Minecraft?

Engagement level is super high.

Most kids have some familiarity with the game.

The ability to “mod” Minecraft is enticing (though this isn’t modding in the strict sense of the word).

Support is good. I highly recommend getting a copy of the Mython “bible”: Adventures in Minecraft by David Whaley and Martin O’Hanlon. These two gents from Great Britain literally wrote the book on coding Minecraft with Python, and it’s all laid out in an attractive, logical, and clear way, with lots of cool challenges to extend your learning. The authors host an awesome website (www.stuffaboutcode.com) which has a forum for those thorny questions. They are more than willing to help out, and I’ve found these two to be always helpful. In addition, they are on Twitter and have always responded quickly, kindly, and accurately to my questions. And version 2 of Adventures in Minecraft now has support for the Microbit board!

Check out the appendix of the book for more resources.

Here’s how I “teach” Mython. As you might gather from my pedagogy, there’s a reason I put “teaching” in quotes. I stole the idea of the “hackpack” from Chris Penn in Great Britain, as well as some of his excellent code ideas and challenges. I print out “hackpacks” for each student. These include anywhere from 4-7 programs on a particular topic (the first covers basics and building, the second covers triggers, etc.). The code is liberally commented with explanations of what the code does, how it works, analogues to Scratch, gotchas, and whatever I think will help the students understand the code.

And yes, I give them a printed paper copy of the code. That’s by design. I know that copy/paste works great for getting code, and I use it all the time. However, I believe when a student is learning a new language, the muscle memory that she uses by actually hitting the keys and looking at the screen is invaluable in making it stick. It also gives the student a fabulous opportunity to become personally acquainted with error messages! I tell them that error messages are their friends. They don’t believe me, of course, but it’s true, because Python is training them to speak in a way that it understands!

That, of course, is the big difference when we take the training wheels off! It’s now possible to make syntax mistakes! Spelling! Punctuation! Capitalization! Indents! All of it matters. And Python doesn’t know “what you meant”; it only knows “what you said”. Sorry! But welcome to the wonderful world of code.

The good news is that students want to make their code work, and they’re willing to keep at it, fixing errors, until it works. Aha, the magic of Minecraft! Much preferable to doing coding exercises that sort lists or do math or any of the other introductory exercises I’ve seen. I have to confess that my reaction to all of those is a great big “meh”. Who cares? I already know what 8 + 7 equals. Doing it in Python doesn’t make it much more palatable. But if I can figure out how to teleport myself 80 blocks up in the air and 40 blocks to the east, well, that’s cool! And incidentally it’s also teaching a 3-dimensional coordinate system, but shhh…. stealth teaching, remember?

So they get their hackpack, and they type in the code, and it works! Fiero! The dance of joy! But they don’t actually earn any credit for that. I tell them, “Congratulations, that means you can type.” To earn points, they must code what I call a “reverse”. That is, they have to take that code and do something different with it. For instance, one of the hackpacks has code that updates my position every second and displays it in the chat window with the relevant x, y, and z position. The “reverse” is to display it every 4 seconds. Hmm… how to do that? Well, where in the code do you say to display it every second? We look at the loop (while True:) and find the code that says to get my position and post it to the chat. Do you see anything that says to do it every second? Oh… time.sleep(1)! The light goes on, and they swap out the 1 for a 4! Easy peasy! But they’ve learned about a loop, they’ve learned how to get and update my position continually, they’ve learned how to print that to the user (Hello World!), and they’ve learned about delays as well (and that you have to import the time library in Python for it to work).

And I didn’t have to stand at the front of the class and say, “Today, class, we are going to learn about… now follow me as I type on the screen and type that exactly, all together now…” Yawn. Students do it at their own speed and find their own “aha moments”! And they get to see it actually happen in Minecraft, on their screen, caused by the code that they just typed in! Woohoo!

So you can see why I’m excited about using Minecraft for teaching coding!

Another carryover, I’m hoping, is that when they go from my class in 8th grade to our 9th grade CS class, where they will code their own original games using the Pygame library, that at least some of this will be burned into their brains. At the very least, they’ll remember they have to be careful with what they type, since they learned firsthand how picky “the Python” can be!

So if I had a standards-based curriculum, what CS standards and concepts have I “covered”? By the time we’ve finished the unit, we can check off: conditionals, events, triggers, 3D coordinate systems, for loops, variables… in Python, they’ve learned about importing libraries, proper indents, colons and why they’re essential, and how to read Python error messages. But again, shh…. let’s not spoil the fun.

Minefaire 2016

Wow, what a weekend!

I was thrilled to attend Minefaire 2016 near Philadelphia, PA this weekend, where a Guiness world record of attendees met their favorite YouTubers, played games, did build battles, sampled VR wares, and even experienced how Minecraft can be used in education. I presented on using Python in Minecraft as an intro to text-based coding, based on the book Adventures in Minecraft by David Whale and Martin O’Hanlon.

Finally met Joel Levin, @MinecraftTeachr, one of my heroes
Finally met Joel Levin, @MinecraftTeachr, one of my heroes.

It was also a personal thrill to meet so many of my online friends and heroes for the first time! Hard to believe that six or seven years ago, this amazing game was just in its infancy in all its 8-bit blocky splendor, causing people to scratch their heads and predict that this would never take off!

 

 

#Picademy!

picademy_cohort
The whole crew, complete with jazz hands.

Just spent a weekend in Baltimore at #picademy, a 2-day workshop presented by the Raspberry Pi Foundation for 40 teachers. And I have to say it’s near the top of a lifetime of PD experiences. Amazing instructors, an inspiring venue (shout out to the Digital Harbor Foundation), and a cohort of 40 enthusiastic, dedicated, funny, thoughtful, creative teachers. Couldn’t ask for more!

bob_computer_picademy
A picture of me taking a picture….

And school starts this week! I have 20 brand new Raspberry Pi’s, thanks to the generosity of the parents group at the Porter-Gaud School, and I can’t wait to get these Pi’s cranking!

What I hoped to get from Picademy was some practical ways to introduce the Pi’s and some ideas for extending Pi skills in the class. Whoa! I got all that and more! And in the best way possible… by experience. We were thrown in the deep end, coding Sonic Pi, Minecraft, lighting LED’s with Scratch and Python…. and even though I had some experience with some of this, I was challenged and inspired. The great thing was to see people with no background in computer science jumping in and trying to make new and cool stuff. On the second day, we have 5 hours to come up with something original. My amazing partner @scratch_boulder (Mai) and I made a Minecraft phonebooth that was triggered by a button or motion sensor, took a selfie, and then built that selfie in the Minecraft world. So much fun!

mc_selfie
Our selfie worked! Props to @scratch_boulder for being such a great partner!

And now on back to Charleston. Tonight is back-to-school night for the middle school, with games and general mayhem in the gym. School starts For Real in a few days.

But I hope to keep that spark alive and stay in contact with my new tribe. Once more into the breach!

Book Review: How to Code in Minecraft by Jim Christian

howtocodeinminecraft_coverThere’s a lot of stuff on the web and in print on how to code mods in Minecraft, most of which requires a fairly hefty investment of time in learning Java. And that right at the outset eliminates a lot of beginning coders. What we need are some entry points for beginning to intermediate coders, which most people who are hooked on Minecraft are. I’ve found Minecraft appeals to all ages, but particularly to the 8-12 age group.

Enter Jim Christian’s excellent book: How to Code in Minecraft. In 146 colorful, jam-packed with coding and Minecraft goodness pages, Jim has given the beginning and intermediate coder a multitude of entry points into doing more than just playing Minecraft, but actually coding it.  He lays out a steady progression of skills, starting with everyone’s favorite intro coding language, Scratch. He then moves to text-based coding with Python, which I’ve found in classes is a logical progression.  From there, he introduces the popular ComputerCraft mod, which uses the Lua language. Along the way, he shows the reader how to set up a free Minecraft server, how to set up and use various development environments, and points the reader  where to go after mastering the skills in this book.

Jim doesn’t leave out teaching basic programming principles, like variables, functions, loops, and events. But it’s so much fun along the way that it’s an excellent example of what I call “stealth learning”. Sure, you could give kids lessons on those topics, but they’ll be way more engaged if they’re setting traps, setting off fireworks, and creating their own in-game games! Instructions are clear with an abundance of colorful illustrations. Jim also leaves blank pages for notes at the end of each chapter, as well as suggestions for expanding the student’s knowledge with fun challenges and projects.

If you’re looking for a solid, comprehensive introduction to coding in Minecraft for your class, club, after-school program, or for that Minecraftaholic in your family, you’d be hard pressed to do better than this book. My only complaint is that it’s not yet available on Amazon in the US!

How to Code in Minecraft — Jim Christian ISBN 1-78106-519-5

Planning the Raspberry Pi invasion

raspberry-pi-logoIt’s the next to last day of school. So naturally my thoughts are on next year! I’m still in “school mode” and not in “summer mode” quite yet. Give me a few days…..

I’m planning to inject some serious Raspberry Pi goodness into my middle school curriculum next year. It’s exciting and terrifying all at once. So what’s exciting? I truly believe in the mission of the RPi Foundation…. bringing hands-on computing to students today. And I believe that the Pi is the best way forward and will bring back some of the excitement that many of us felt when personal computers were brand new.

And what’s terrifying? Truthfully, it’s the sheer magnitude of what you can do with these things.  Go through the forums, follow people on Twitter, read the MagPi magazine, and you’ll be overwhelmed with what you can do with these things: refrigerator monitors, space exploration, weather stations, Twitter feeds, Minecraft coding, live music coding, electronics, sensors, oh my! The list goes on and on.

Fortunately I ran a Creation Station club this year, where I got students to experiment with various projects on the Pi (among other things), so I have some ideas of what might work. I’ve got 20 Pi 3’s, and 20 Sense HATs. I figure that right there should give us enough to play with for year one. I also have an assortment of one-off pieces: floras, cameras, etc. So any of those might spark serious interest, too.

Along with those ideas, I’m also working on logistics — where do I store them, how do I share them between classes, how do I back up student work, how do we run them in our iMac lab…..

Stay tuned for further updates over the summer! Also hoping to be chosen for August’s Picademy in Baltimore!

Hacking the HackPack

minecraft-pythonAs promised, here’s the skinny on my current Mython approach. I can’t really claim credit for most of it, as I’m using the Adventures in Minecraft book by Whaley and O’Hanlon, as well as some great starter code by Ben Davies, @ncscomputing, and others in GB.

I have three “hackpacks”, which are packets of sample programs that I print and distribute to students. They basically copy the code and run it. After they complete all those successfully, they then use a “reverse hackpack”, which consists of coding challenges based on the programs they just finished. Most have some minor changes required, but all are extensions and applications of the code they did. When they can successfully do that, I sign off on each challenge. I usually ask them to explain something in the code to be sure that there is understanding of what the code is doing.

There are a few spots that I actually “teach” to the whole class, though I try to limit it to 10 minutes maximum. One of those spots is the while True loop in Python, and the other is for loops. Everything else is addressed individually or in small groups as needed (“just in time” learning).

So far I’ve been very pleased with the level of engagement, effort, and learning. It’s the first iteration, so I’m fine-tuning as I go, of course!

Mython — next time around

hackmythonJust started my unit on coding in Minecraft. It’s 8th grade and their first introduction to text-based coding. Scaffolding — they’ve all done Scratch and LEGO robots in 7th grade, and GameMaker in 8th grade. So this is our first dive into the deep end…..

I’m using what I call Mython (Minecraft and Python), based on the Adventures in Minecraft book by Whaley and O’Hanlon. I gave out a packet of 8-9 introductory Python programs which they typed in. the purpose was to get them used to typing code and learn some basics along the way. The programs are from the Adventures book mainly and do things like display text in the chat, track the player’s position, and build things. I don’t expect them to understand it all.

Today I introduced what I call Reverse Hackpack #1. It’s a series of coding challenges that are slight modifications of the code they already did. They have to figure out how they did something like that in the previous code and then make changes. I’m making badges/stickers for completion, and they have to explain the code to me to earn their badge. Here’s a link to that if you’d like it.

This is my first try at this approach but I’m liking it so far, and the kids seem to be not only enjoying it but learning. As I told them today, “If you’re not frustrated, you’re not learning!”

Wearing Different HATs

If you’re a Raspberry Pi fan, you already got the joke. If not, well…… a HAT for a Raspberry Pi is Hardware Attached to Top. Get it? OK, it’s geeky humor…

skywriterAnyway, I just got three brand-new HATs to play with: the Pimoroni Skywriter HAT, the Piano HAT, and an LCD touchscreen (Pi-size). I’ve only had the chance to play a bit with the Skywriter, which has near-field 3D gesture detection (think I got that right), and I’m dying to get that X-Wing built in Minecraft and then fly it by hand gestures above the HAT. I spent about an hour, getting the Skywriter library, trying to use some code (here’s the project: http://robotsandphysicalcomputing.blogspot.com/2016/01/guesture-controlled-minecraft-x-wing.html), finding it needs an extra Minecraft Pi library called minecraftstuff, figuring out where the minecraft api on the Jessie distro is…. so I’m still grounded. However, we’ll be taking off next week for sure!

Pimoroni-Piano-Raspberry-Pi-HAT-1The Piano HAT allows you to “play” the piano on your Pi. The really cool thing is that you can do all kinds of music with it, but you can also code the keys to do anything else you want — make weird noises, turn lights on and off, turn motors on and off…. Can’t wait to play with that one!

And the LCD screen frees you from a monitor and keyboard for your Pi. I personally find it just too tiny for my eyeballs, but I can see it working with an embedded Pi doing all kinds of cool things — retro gaming, a DJ system….

Did I mention I’m also diving into using Sonic Pi (live music coding) in Minecraft? The Sonic Pi api includes some Minecraft stuff (written in Ruby), so you can lay down some beats with Sonic Pi, then build stuff as you move around in Minecraft, synchronized together! It’s just too cool for words.

So I’m getting ready for next year’s classes when we move much of my curriculum over to the Raspberry Pi. Look out!

Mython Launch Success!

mython2Mython is the word I use for MinecraftPi. Today I launched it in my 2 8th grade classes, and I am super-pleased with the results. First, it all worked technically, which is always great! I did have one student who was experiencing some connection difficulties but I think that might have been one of the multiple login/profiles used incorrectly.

Second, kids seemed to enjoy it. By one of the quirks of this year’s schedule, my two classes are split exactly along gender lines. My boys class dove in enthusiastically and basically executed code as fast as I could feed it to them (on two screens). A few were extending the code by the end of our 45 minute class, adding in new blocks. My girls class probably outdid the boys in enthusiasm and made similar progress.

People helped each other find errors and troubleshoot, shrieks of delight filled the air when things worked, the opposite when it didn’t….

To place it in pedagogical perspective, this followed about 3 weeks of drag and drop coding in GameMaker and 2-3 days of introductory Python, using turtles. So this is their first introduction to text-based coding. We are going to spend the next several weeks doing Mython. Thanks again to David Whale and Martin O’Hanlon for their excellent book, Adventures in Minecraft, which is the inspiration for this.

#CSTA15

CJ40XdMUcAA263HSo many firsts last week — first time in Dallas, first time at the Computer Science Teachers Association conference, first time presenting at CSTA, first preso on Minecraft…. Lots of cool stuff to report!

My presentation was on Teaching Coding in the Middle School with Minecraft. You can see the preso in Google Presentation form right here. I have wanted to use the power of Minecraft as a bridge to learning coding for some time, so I spent this school year experimenting with different approaches. My preso is a summation of those, with the proviso that I had some very specific goals in mind, which would probably be different from yours. So YMMV, etc. Spoiler alert: I finally settled on the approach used in Adventures in Minecraft book by Martin O’Hanlon and David Whale. It uses Python, and it seemed to work great with my classes.

My Twitter feed blew up the night before, as word got out about my preso. Got to say it was very cool to get all that support, especially from the aforementioned Martin(@martinohanlon) and David(@whaleygeek).  The actual preso was well attended and it seemed to fill a need, as most people were aware of Minecraft and were interested in seeing what they could do with it in their classes. Keep in mind that this was a CS teachers’ conference, so we were looking at that very narrow strip of MC usage.

I got an invitation at the end of my session to present a pre-conference on Minecraft next summer in Denver at ISTE. Cool!

So what I enjoyed about my first CSTA:

  • being at nerd central — coding, cool machines, cool apps, and
  • cool people! Special shoutout to Dr Sarah Guthals(@sarahguthals) from LearntoMod who has a great product and is an awesome fellow traveler on this coding in Minecraft journey sarahme
  • meeting some people I only knew from reading them, like Alfred Thompson(@alfredtwo) and Mark Guzdial, and Laura Blankenship(@lblanken)

 

 

So what’s next? Definitely a determination to learn more Minecraft — modding, servers, coding cool stuff in Python…. and a determination to connect with other educators doing this or interested in doing it. Would also love to connect with some modders and learn more about that…. got to finish my Digital Youth course on learning to mod in Java, follow up on LearntoMod’s growing product, learn some more javascript…. oh, and get ready for school… learn more GameMaker, App Inventor, Small Basic…. got to go!