Learning C through BASIC?

While trying to think of ways to make learning the C programming language a less frustrating experience, I was struck recently with the idea of writing a complete tutorial on C entirely from the viewpoint of writing games. I’d be teaching pure ISO standard C, so that means I’d have to stick with text-based games. Still, doable.

Anyway, thinking about this made me remember a set of C books (BASIC Computer Games and More BASIC Computer Games) that I used to check out all the time from the Sacramento Belle Cooledge Library when I was a kid (it was at a completely different location back then, FWIW). These were books filled with nothing but listings of BASIC source code for hundreds of text-based games.

So I did a quick search for these books, to see if I could still find them somewhere, and lo, to my surprise, their complete contents can be found at AtariArchives.org!

It’s a bit of a pain to use them (as it was before), because they’ve only stored the contents of the books as graphic images, so you still have to go through the tedium of typing it in, line-by-line, by hand. I’ve done a couple again, just to check them out. Unfortunately, the quality of code is extremely poor (even for BASIC). Even though I already knew the essential concepts behind maze generation, it took me the weekend (working only here and there) to grok what the cryptic code was actually doing in his version of Amazing (the first maze program). Ironically, I later found the original Amazing listing (actually, I’m not positive), and found it to be far more understandable (though the comments refer to erroneous line numbers).

Anyway, I’m trying to go through some of these, to get an inventory on what sort of C concepts one might be able to teach through writing games of these sorts. I played with a few BASIC implementations on Linux, but the one I came away most happy with for doing this legacy code is FreeBASIC (also available for DOS and Windows). Bywater BASIC worked well at first, but it ended up having some somewhat buggy code, and it’s “execute not-understood commands in the shell” feature ended up being less than useful to me.

I’m getting a bit sidetracked now, though, because I had enough fun looking into the maze program, I figured I’d try my hand at doing one in PostScript (which seems an ideally suited language for printing graphical representations of mazes). I’m sure it’s already been done to death, but it’ll be fun. When I’ve finished with that, I think I might try to do a radial (circular) maze generator next. Whee!

One thought on “Learning C through BASIC?

  1. RandomGnome

    I like the site bro- pretty much covers all the important categories. Just wish your C/Game book was happening 🙂 return(0) }

Comments are closed.