Culture / Development

Code n00b: What I Learned Playing ‘Learn to Code’ Video Games

25 May 2018 3:33pm, by

Whenever I tell people at parties that I’m a JavaScript programmer, I typically get The Look: polite smile, glazed-over eyes, sudden need to go find someone (anyone!) elsewhere across the room. Sometimes instead of The Look I get hit up for tech support, that’s always fun. Or — if it’s truly my lucky day — I’ll get pitched an idea for the next killer mobile app sure to make us both rich. The most recent version of which just happened to me at a community block party:

Neighbor-cornering-me-by-keg: “We can make iCloud, only for Google devices!”

Me: “Oh, you mean kind of like Google Drive?”

NCMBK: (delighted to feel his visionary geniushood being so appreciated, visions of the private island he’s going to buy dancing in his head) “YES!! Exactly!!”

Me: … drinks beer fast, refills cup, drinks again …

Every now and then, though, people want to ask me about how they too can learn to code — or, given where I live, how their kids can learn to code. I quickly realized that an earnest discussion of actual learn-to-code options — boot camps, online academies, actually reading books — is almost never what they’re looking for. They want me to tell them there is some kind of magic bullet. A low effort or, better still, no effort learning method that leads to surefire success. Also, fun and free. After I’m done inflicting self-injury via eye roll, I start telling them about the gamification of computer programming instruction. As in, there’s an app for that — or an entire video game genre, even.

Can these games truly teach the skills that pay the bills, though? Is it really possible to become an actual programmer by just, you know, playing some video games?

Games to Learn Coding?

I’m willing to consider the possibility because I already use some games to teach CSS concepts and skills: CSS Diner, Flexbox Froggy and Grid Garden. I’ve witnessed the great moments of cartoon lightbulbs illuminating my students’ brains as they apply the concept of, say, “flex-flow:column-reverse wrap-reverse” to maneuver a cartoon frog home to his lilypad: Hey, this abstract code actually DOES something! So maybe this “ah-ha!” learning-though-games moment is possible for other coding skillz as well, though I doubt it’s yet possible to pick up C# through maneuvering cartoon frogs anywhere, anyhow.

So I decided to take a good look around to see if there are any games that are actually useful conduits for learning to code. Dug through Ye Olde App Store, Steam too, and also asked my own kiddos what programming games they’ve liked/found helpful, trying to find some good possibilities. Or…not. There didn’t seem to be any, unfortunately.

This is not to say there aren’t options. Hoo boy, there are all kinds of options: You can learn to code from Spiderman! The Angry Birds!  Cute baby animals of every kind! All designed to feel accessible and unthreatening to programming newcomers! The problem is that most games I tried are so unthreatening they don’t actually get around to teaching, you know, even basic programming concepts. And the ones that seemed to have actual knowledge to impart were way, waaay too advanced for people starting at zero coding experience.

(That said, I did find TIS-100 and it looks amazing IF you’re already a reasonably advanced programmer and maybe also ninja-level computer nerd. Billing itself as “the assembly language coding game you’ve been waiting for,” TIS-100 is now on my list of Things To Be Addicted To This Summer. But only if(have_experience===true).

I still believe gamification of coding works when it’s done right, and — I’m increasingly coming to see — as an addition to other methods. But I had a hard time finding games I could point beginners (at least, those interested in learning actual programming and not web stuff) toward and say, GO. DO.

Human Resource Machine

With one exception. I came across this game as a beginning JavaScript coder and found it genuinely helpful. At the core, Human Resource Machine (HRM) is all about data processing. As a cartoon factory goon, your job is to take tiles (marked with numbers or letters) from the IN conveyor belt. The challenge: figure out how to place and manipulate them to meet the criteria of each level’s “job” in order to send OUT the correct ones. To do this, you draw from a list of simple commands — essentially, a kind of proprietary assembly language — to create a list of steps for Toon You to follow. Um, what does that sound like? Oh, yeah, essentially, a computer program!

(Also, given that tiles rolling in on the conveyor belt are randomized, your solution has to account for all possible input. Sound familiar?)

HRM gameplay is simple, but not easy. As the levels progress and the tasks become more complex, it causes even experienced programmers to stop and think things through.

By framing itself in familiar concepts like conveyor belts and floor tiles, and by offering only a small list of commands to work with, HRM is actually a solid introduction to the core principles of programming. Color-keyed command blocks and arrows replicate the language of flow charts, and players can either “run” the program start to finish or step through each command debugger-style. HRM-invented terms like “jump” and “bump” may not translate literally to any actual programming languages. The concepts, though — assigning variables, arrays, loops, ‘if’ statements — are bedrock.

I have actually recommended this game to people who’ve asked me about programming games, and their responses fall into three categories. First up: “Too hard, it made my brain hurt and I didn’t like it.” Guessing programming is not your bag then, baby. Second: “I made level 20 in 20 minutes! Did you know you can just Google the solutions for each level?” Um, that actually is not ideal but this person might yet have a future in programming. And finally, “That was challenging but AWESOME.”

After conquering HRM, this final group of folks are pretty well-equipped to start learning how to code for real. Or move on to The Tomorrow Corporation’s follow-up game, introduced earlier this year. Seven Billion Humans tackles parallel computing, something I could stand to get a better grasp on myself.

Currently, I am SO stuck on level 11.

Check back for Code n00B every other Friday, found here only on The New Stack.

Feature image: Human Resource Machine: assembly language as a video game.

A newsletter digest of the week’s most important stories & analyses.