Sunday, March 19, 2017

Learn programming by gamifying? How about by reading?

On impulse I spent a couple of dollars on Amazon Marketplace to buy the out-of-print book Micro Adventure No. 1: Space Attack.  It's a "second person thinker" adventure novella: like old-school interactive fiction (i.e. text adventures),  it's written in the second person, as in "Although you'd like to rest for a few minutes, Captain Garrety insists that you get to your feet…"

In this short story aimed at pre-teens—the first in a series of at least 10, dating from the early 1980s—you must defend a space station from alien attack. But the interesting bit is that eight BASIC programs are embedded into the text of the story, as the page scan below shows.

The initial program just has to be typed in and run in order to reveal the "secret message" that will describe your mission to you. But as the book goes on, the programs require you to debug, analyze, or otherwise modify them as part of the story line. Some programs have bugs you  must fix; in other cases you're asked to write a short program that automates a simple task, such as showing mappings between text characters and their ASCII codes (this is pre-Unicode, remember), in order to help "decode" enemy messages.

Of course, failing to do the puzzles can't block your progress in the story, because nothing stops you from just turning the page to keep reading. But this strikes me as an interesting way to get kids to learn how simple programs work. There is a "reference manual" at the end of the book explaining how the programs work, giving hints on solving the puzzles, and, of course, indicating which modifications must be made to allow the programs to run on different microcomputers. (Whereas code in a modern scripting language like Python will behave the same no matter what kind of computer it's run on, BASIC "dialects" differed enough across different computers that almost any non-toy program required changes to work with other computers' BASIC interpreters.)

An entire generation of programmers was first introduced to computing via the BASIC language. I've been looking for an example of an old geometry or physics textbook containing "Try it in BASIC" examples (we didn't use any of those at my middle school), but this seems a lot more fun. While I'm pretty convinced today's kids don't read books anymore, perhaps this approach could be adapted into an interactive format in which you actually play an adventure game but have to solve programming-related puzzles to make actual game progress. 

No comments:

Post a Comment

Comments are disabled because the only commenters are spammers, despite Google's best efforts. But I welcome actual comments: Google my name and you can easily direct an email to me, and I'll publish your comment here.

Note: Only a member of this blog may post a comment.