Applesoft BASIC JavaScript Emulator: My First Game (from 1979)

I found this emulator the other day : Applesoft BASIC in JavaScript   last week while at GDC, and it got me thinking about the first games I wrote on my friend Eric’s Apple II back in the 70’s .  I was 9 years old when I first touched the keyboard of an Apple II and wrote my first program.  The power I felt while touching that keyboard was indescribable.   I went directly to the library and checked out a couple book about programming in BASIC, wrote programs in notebooks, and then begged Eric to let me try them out.

As the years passed, I never had access to the programs that Eric, my brother, and I typed into the Apple II.  They are locked on disks that Eric still owns, 1000’s of miles away.  However I do recall one of  the very  first (if not the first) real “games” we wrote together.  It was a “Guess The Number” game.    After building elaborate ASCII rockets with “PRINT” commands for days, Eric’s dad (A computer engineer at Hughes Aircraft)  taught us about about “IF-THEN” and “GOTO” statements and then we went to town.

apple2firstgame

Because I have not seen the game in 35 years, I rewrote it using the emulator.   My favorite discovery was the “FLASH” command.   I had forgotten about it, but when I saw it in the reference guide, it sent me back decades.  It was a  magical command to me when I was 9 years old.  It seemed like, with “FLASH”, I could create a real “reward” for winning the game. Finding the roots of my love for computers, programming, and making games does not take an extensive search.  It’s pretty much right here in these 20-odd lines of code.

10 HOME
20 INVERSE
30 PRINT "NUMBER GUESS"
40 NORMAL
50 MAGICNUMBER% = INT(RND(1)*100)+1
60 LET TURNS% = 0
70 PRINT "I'M THINKING OF A NUMBER (1-100)"
80 INPUT "GUESS:" ; NUMBER%
90 TURNS% = TURNS% + 1
100 IF NUMBER% == MAGICNUMBER% THEN GOTO 170 
110 IF NUMBER% > MAGICNUMBER% THEN GOTO 130
120 IF NUMBER% < MAGICNUMBER% THEN GOTO 150
130 PRINT "<<LOWER" 140 GOTO 80 150 PRINT "HIGHER>>"
160 GOTO 80
170 FLASH
180 PRINT "YOU WIN!"
190 NORMAL
200 PRINT "YOU DID IT IN " ; TURNS% ; " TURNS"
210 PRINT "HIT KEY TO PLAY AGAIN"
220 GET K$
230 GOTO 10

-Steve Fulton

0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.