loading...

Choose Your Own Adventure

leekeith profile image Keith Lee ・5 min read

Allow Myself to Introduce... Myself

This being my first post on dev.to, I think I should say a few words about myself. I am a computer engineer. I work at a hardware design company called Gumstix. I get to work on maker-esqe projects, develop on our Arduino-compatible and embedded Linux products, and work on back-end automation services for our online design tool.

I am a father of three, a husband, a brother and a son. I am many things but most of all, I am always learning and discovering.

In the context of this social media platform, I am always learning how to be a better developer. I've been working on that off and on since I was a wee lad.

Early Beginnings

Brace yourselves, I'm about to date myself.

My parents got our first personal computer when I was 7 or 8. It was a second-hand IBM PCjr and it was AWESOME! We had Lotus AmiPro and 123, Adventures In Math and Rocky's Boots! And would you believe it? There was an escape sequence you could enter that would load a cool built-in typing game. You'd hit a key and this little Mario-looking guy would come down and take it from a keyboard on the screen.

I'm not quite sure how many hours I accumulated on that particular little gem, but it was a lot.

But one thing it had, that I am mostly interested in discussing here, is BASIC. Now BASIC is this programming language (the purists will argue that it's a scripting language. Groan). that is... well, basic. Here, let me show you with the obligatory Hello World.

10: CLS
20: PRINT "Hello World!"
30: INPUT "Continue"; in$
40: IF in = "y" OR in = "Y" THEN GOTO 20
50: END

*by the way, the semicolon on the INPUT line will ensure that a question mark is inserted after Continue.

Now seeing as how this is all pre-world-wide-web, I had nothing to help me but the user manual and my mom's knowledge of programming (she hadn't told me this yet but when she was in university, she was programming with punch cards and FORTRAN). But I slogged through it.

Adventure

So what does a 3rd grader program? Games! I worked as a tutor for some awesome kids for the better part of a school year and discovered ONE IMPORTANT DETAIL: You CANNOT convince an 8-year-old that making an LED blink is as satisfying as making a kitten jump around the screen. So I tried making some games.

Now, when I was in elementary school, 'Choose your own adventure' books were really popular. Now you have to go to the recesses of used book stores just to find one. I haven't met anyone under the age of 20 that's heard of them these days.

So how did they work?

Image courtesy Amazon.com

Something like this:

  1. Flip to page 1 and read the story
  2. At the bottom of the page, there will be a decision to make.
  3. For each choice, there is an associated page with the result of your decision and another set of choices.
  4. Repeat until you either:
    • finish the story
    • meet your demise in a gruesome battle with a cave troll

It's kind of like a 'fiction programming language.'

So having read every single one of these books in the school library, I decided to make one in BASIC.

Prep Work

OK, so at this point I'm a 3rd grader, so my planning stage goes something like this:

"Alright, let's make this game. It starts... in an empty mansion!"

Check!

"Great, let's code!"

Done.

Development

Allow me to remind my audience that this is all occurring prior to the advent of source control and interwebs, and in fact, commercially available hard drives. My progress had to be saved on 5.25" floppy disks. Remember those? The BASIC "IDE" (if you can call it that) was similar in appearance and operation to nano, with absolutely no context highlighting, no debugger, and absolutely no help at all. A plain old text editor.

I started coding, starting with some print statements. (The actual source is long gone. Even if I had hung on to the magnetic media on which it had been stored, it would have demagnetized by now, so any code will be paraphrased.)

1  PRINT "    The Something Something Mansion"
2  PRINT "    -------------------------------"
3  PRINT "By Keith"

So at this point, I'm looking at my code and comparing it to what I see in the PCjr's user manual and I'm thinking: "This works, but they start all their lines with 10, 20, 30, etc. I don't get it..."

I cary on:

4  PRINT "You are standing at the closed front door.  There is a doorbell and a newspaper here."
5  PRINT "you can [O]pen the door, [P]ick up the newspaper, [R]ing the doorbell."
6  INPUT "What do you do"; action

At this point I realize that I want another line of description above the list of possible actions. So... I go back and write more.

5  PRINT "Something something blah blah loreum ipsum..."

or something like that. "Oh no," I think, "Now I have to change the numbers on the next two lines!" Then it dawns on me... THAT's why the lines go up by tens! That way, I could have numbered this new line 41 and not have to touch the other two lines. So I fix every line and carry on. In the process, I face the challenges of conditionals, branching, creating an inventory system, and so on. I made it far enough into the game that it took 15 minutes to complete the game, it had a handful of "dead ends", and an alternate ending.

Pretty good, if I had said so myself. I'm not sure I showed it to anyone else.

To Explore This New Digital World Further, Turn to Page 55

For the rest of my grade school days, I dabbled. I'd read up on C programming and write little toy programs, I took an extra-curricular class on Turbo Pascal, which I never used ever again, and generally absorbed programming knowledge.

During all of this time, I also started disassembling and reassembling PCs, curious about what hard drives looked like, how the CPU's mounting brackets worked, what an IDE cable did (Pre-SATA drive connector cables), and so on. I installed PCI sound cards, AGP video cards, front-facing USB ports and cold cathode case lighting.

I was dismantling RC cars and rewiring singing birthday cards with bigger speakers (Why? To annoy my parents of course!). I would torture Windows 3.1 and then 95 until it broke and then play with it until it worked again. I got comfortable with all aspects of technology, computers and, if I'm honest, video games.

Along the way, the Internet came to my house. My parents made sure we were on-board early. Some of you may remember how painful it was to search Webcrawler for Super Mario World tips and secrets at 14.4 Kbps. And how every time the phone rang, you'd have to wait for Mom to get off the phone before dialing up again.

To Be Continued...

Well that concludes my origin story. I hope you enjoyed it. I'll be sure to add to it at some point and try to bring the masses up to date on my long journey to the SW engineer I am today. Until then, carry on...

Posted on by:

leekeith profile

Keith Lee

@leekeith

Computer engineer with an interest in logic design, HAL, embedded and learning.

Discussion

markdown guide