Mobile STEM: Power of Code pt. 1

|  By Jeremy Knowlton

WMSI Mobile has been busy with STEM Explorers these past few weeks. We've now been facing exciting challenges involving computers. Most computers these days can do amazing things; however, these computers are usually "un-tinkerable". Users aren't supposed to open them or play around with the code that makes them work. Using Raspberry Pi, an extremely cheap, open-source computer, STEM Explorers have been able look at what a computer really is. Not only that, but we've also been able to look at some of the text-based code that helps run our world!

 The Raspberry Pi, a $40 "handheld" computer

The Raspberry Pi, a $40 "handheld" computer

The first challenge was to put the computer together by following a diagram, a challenge considering most household computing devices these days are phones and laptops. We then tasked them with a challenge: "find Minecraft on your Pi". Explorers searched away with a gleam in their eyes. Minecraft is, quite simply, the best. On one hand, It is a game of almost pure creativity.  With building blocks from a rich inventory of materials, players can make anything from a cabin to a mansion to abstract art.

Soon every Pi had miners and builders exploring new places and worlds. Now was the time to unleash the power of coding. Explorers pulled up a program called Python, which is a very powerful text-based coding program. Next, they ran an example program called Megablock.

 Gorham students generating a massive hollow block made of TNT. Giggles erupted as they set the TNT off and maxed out their computer's CPU

Gorham students generating a massive hollow block made of TNT. Giggles erupted as they set the TNT off and maxed out their computer's CPU

With the magical press of a button (F5), a towering block of lava appeared on their Minecraft screen. No way! A towering block of lava is great, but students quickly saw the value of making cities and mazes using this program. They edited the python code, making diamond, TNT, dirt, and obsidian megablocks of various sizes. Creativity in coding spread like wildfire across the room!

 The Megablock python code. Everything in red is instructions for the Explorers

The Megablock python code. Everything in red is instructions for the Explorers

After students made 3 megablocks, they got to unlock a new Python program: CastleBuilder. Explorers opened the new program and read through the code. Students then took their code knowledge a step further. They edited the x, y, and z coordinates to change the size of the castle and also changed their water moat into lava. They hit F5. A towering stone structure with battlements, windows, and a moat appeared on their screens. Looks of concentration turned to grins as students explored their new castles, adding beds, windows, libraries, and crafting rooms. What would have taken two+ hours manually was completed in seconds using programming. Coding is so cool!

 Collaborating over some parkour courses!

Collaborating over some parkour courses!

Here at WMSI, we want to turn coding into something less scary sounding. We firmly believe that anyone can learn to code if they are given small, fun, and achievable steps which progress from simple to complex (sort of like playing a level-based game!). Rather than asking students to write computer programs from scratch, we ask that they read the code, understand it, and edit it to make it their own. At the end of this process, they are rewarded with something cool like a Minecraft castle, which spurs on future coding interest! 

Next time: how can we create a mini game in Minecraft using loops, random number generators, and megablocks? Stay tuned!