Tuesday, May 8, 2007

Star Trek, BASIC and Arrays

I think most of all my early programming ideas were advanced by writing games. When I was still a beginner I decided to create my own version of the classic Super Star Trek game that I played on the Babson College minicomputer on a dialup connection from the Needham Public Library.

I grabbed a yellow lined notepad and started writing code in BASIC. After a half page of code I began to write lots of IF THEN statements, one almost exactly the same as the next. I realized after a bit of this that my program was going to be gigantic!

So while I was walking to the library with my brother Ernie I told him what I ran into while trying to write the program. He explained to me that I needed to learn to use arrays (he called them subscripted variables). I really had no idea what he meant. I can't remember clearly how I learned about arrays, except that Ernie must have shown me how to use them. Along with arrays it was great to learn about nested loops.

With his help I was able to write a version of Star Trek in BASIC for my father's Heathkit H-89. Later I wrote a version for the VIC-20 as well.

So this was a breakthrough moment for me. Arrays make many kinds of game programming practical, and I made good use of them. It was easy to for me to see that to create a game is to craft a simulation (even if for an imagined reality). This insight served me well as I wrote more and more software.

No comments: