July 27, 2005

A Programming Question

Last week, Anthony (my 6-year-old son) came home from summer camp and tapped me on the shoulder while I was working in my home office.

"How long does it take to make a computer game?" he asked.

I looked up from my work for a second. "Maybe five years." Anthony is always full of such questions, and sometimes I have no idea where they come from. He never had too much of an interest in my line of business before.

"That's a long time," he said.

He stood there, next to me, watching me debugging code for a few minutes. Then he spoke up again.

"How about a really easy game. Like a pet show?"

Ah hah. Now I see what he is asking....

"Anthony, do you want to make your own computer game?"

"Yeah, and Sam does too. And his sister too." Sam is Anthony's friend from summer camp. It turns out that Sam and his sister and Anthony have been coming up with lots of ideas for computer games, and they want to make them. Sam's sister wants to program a pet show.

"Maybe we can do something," I promise him, "Maybe tomorrow."

But really, I am puzzled. I am not sure if there is a good way to answer his question in 2005. It is not 1979 anymore.

Freeze Frame: 1979

In 1979, American suburbia and geekdom was swept by the arrival of the new "Personal Computers" from Atari, Commodore, Apple and Radio Shack. Those years, any kid who had a computer at home was the envy of his friends.

"Hey, can I go to Sam's house and play computer games?" my son asks today. In 1979 I often asked the same question. But the friend was Dennis Yee, and his computer was an Atari 400 running a 1.8Mhz 6502 attached to a TV set and a tape recorder.

Let me tell you, that beige UFO-shaped computer was way more interesting than a home PC today. In 1979 Dennis was the only kid I knew anywhere who had of these "computers". And so all the neighborhood kids would find their way to his house, where the computer was set up on the dining room table, ready to show itself off to a crowd.

It did not matter much that the software was primitive back then. It was all great stuff, so new, so neat. You can play Space Invaders at home! And people were writing new software all the time - I remember lusting after Caverns of Mars and puzzling over the amazing Zork games from Infocom.

By 1981, I no longer needed to be a spectator. Keeping up with the Joneses, my dad proudly came home from a trip to California with an Atari 800 that year - straight from Atari. Now, what to do with it?

It was time to read some magazines.

The early Personal Computer Rags

Compute. Byte. Creative Computing. Antic. Analog. Did you ever read these? The early "trade rags" were overflowing with exciting content, full of ads and articles and letters on the new devices. They were thick magazines! As a 11-year old in 1982 I remember flipping through newly arrived issues of Compute and thinking, "by the time I read 300 pages, the next issue will be here!"

The magazines wrote all about what you could do with these early computers. That basically came down to three things:

1. You could play games.
2. You could do serious stuff like spreadsheets or hardware.
3. You could write your own programs.

Actually, there was a fourth thing you could do, and these magazines were chock full of it, more than anything else.

4. You could type in programs that you didn't understand.

They were filled with source code for fun programs - they were, in a sense, the earliest "open source" for personal computers. I remember spending days and days typing in a program called "Gold Miner" which was basically a game where you try to blow up rock to get gold without getting trapped in the mine. And then I spent days and days playing it. What a great game, and how empowering to be able to have typed it in.

I also typed in a program for making your own Atari 800 fonts, and then I invented a whole bunch of fonts. I typed in a program that let you enter machine code directly, and then I used that program to enter an high-performance program for a cool video game that involved spaceships.

Remarkable Discovery

At first, I had no idea what I was typing in. I remember distinctly the day Dennis Yee explained to me that a REM statement - a BASIC "remark" - was actually ignored by the computer. What a revelation!

I had previously been carefully typing in all the REM statements I saw in the magazines, meticulous with spelling and all, because these REM statements were the only part of the program that I could understand. Surely, I had thought, they must have been important.

The realization that the rest of the program was the important stuff was the beginning of comprehension.

Primary Primer

At one point, my Dad's friend Phil Baker (who worked for Atari in the early 1980s) sent home a real programming assignment for me. Instead of typing in programs I didn't understand, why not try inventing my own program? "Try writing a program that prints out prime numbers," he suggested.

Wow, what a challenge. I understood that BASIC could do math, that it had variables, and that it could do loops, but then I was totally stuck. See, when you did "5/3" in ATARI BASIC, it would give you 1.6666667, and I had no idea how to tell the computer how to use that fact to know that five was not divisible by three.

In the letter he had written with his puzzle, Phil Baker had also clipped the answer. I remember that very clearly too - it was a Polaroid picture of the source code. White on blue fonts, it was literally a full color screen shot of his TV - this was way before inkjet, before laser, before even widespread dot matrix printing.

When I took a peek at his code, I discovered that my program had been right! Except that I had been missing a crucial piece of knowledge. There was an "INT" function built into BASIC that would convert a floating-point number to an integer by rounding down. What I was missing was knowing how to say "is x an integer?" by saying "IF INT(x) = x".

 
10 FOR I = 3 TO 100
20 LET J = 2
30 IF INT(I/J) = I / J THEN GOTO 70
40 LET J = J + 1
50 IF J < I THEN GOTO 30
60 PRINT I
70 NEXT I
 

The prime number sieve was my first real program. It was the first program I actually understood, and the first time I realized that I could really do something on my own with the computer.

Guess My Number

Then I remember reading Albrecht, Finkel, and Brown's book on ATARI BASIC, and really having a good time with it. Everything in that book seemed so clever to me. It still makes a good read today - the whole content is online! My favorite part was putting together the games - and understanding and tweaking and improving them.

Here was one 10-liner game, a classic gem: Guess My Number.

 
100 REM**GUESS MY NUMBER - A COMPUTER GAME
110 LET X=INT(100*RND(1))+1
120 PRINT
130 PRINT "I'M THINKING OF A NUMBER FROM 1 TO 100"
140 PRINT "GUESS MY NUMBER!"
150 PRINT : PRINT "YOUR GUESS", INPUT G
160 IF G < X THEN PRINT "TRY A BIGGER NUMBER." : GOTO 150
170 IF G > X THEN PRINT "TRY A SMALLER NUMBER." : GOTO 150
180 IF G = X THEN PRINT "THAT'S IT! YOU GUESSED MY NUMBER"
 
RUN
 
I'M THINKING OF A NUMBER FROM 1 TO 100
GUESS MY NUMBER!
 
YOUR GUESS? 50
TRY A BIGGER NUMBER.
 
YOUR GUESS? 75
TRY A SMALLER NUMBER.
 
YOUR GUESS? 68
TRY A BIGGER NUMBER.
 
YOUR GUESS? 72
TRY A BIGGER NUMBER.
 
YOUR GUESS? 73
THAT'S IT! YOU GUESSED MY NUMBER.
 
READY
 

The wonderful thing about programming games was, you could play them. When you were done, the code didn't just sit there. Your program could surprise and challenge and enteratain you.

BASIC Was Real

The beauty of writing in BASIC on the ATARI was that there was only a small gap between writing programs like this and writing "real" joystick-and-animation games.

In the early days, commercial software was often written using BASIC. Almost everything you could imagine doing, you could do. You had access to graphics, sound, and devices. And when you ran out of gas in BASIC, there were PEEK and POKE and ways of embedding a little machine language in your BASIC program. The same language for beginners was used by the pros.

Soon after "Guess My Number" I wrote a little game I called "Canyon Runner" where you used a joystick to navigate an ASCII "Y" character down a randomly generated twisting channel of ASCII obstacles. Every fraction-of-a-second the terrain would scroll upwards by one space.

 
XXXXXXXXXX       Y   XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXX           XXXXXXXXXXXXXXXXXXX
XXXXXXXXXX           XXXXXXXXXXXXXXXXXXXX
XXXXXXXXX           XXXXXXXXXXXXXXXXXXXXX
XXXXXXXX           XXXXXXXXXXXXXXXXXXXXXX
XXXXXXX           XXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXX           XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXX           XXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX           XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXX           XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXX           XXXXXXXXXXXXXXXXXX
XXXXXXXXXXX           XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXX           XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXX           XXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXX           XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXX           XXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXX           XXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX           XXXXXXXXXXXXX
XXXXXXXXXXXXXXXX           XXXXXXXXXXXXXX
XXXXXXXXXXXXXXX           XXXXXXXXXXXXXXX
XXXXXXXXXXXXXX           XXXXXXXXXXXXXXXX
XXXXXXXXXXXXX           XXXXXXXXXXXXXXXXX
 

"Even more fun than Gold Miner," was my little brother's verdict. "Though maybe not as fun as Star Raiders." (Star Raiders for the Atari 800 was, IMO, one of the most well-crafted games in history.)

In 1979, you could write "fun" games with the very same tools you were using to learn. The bar was low, and the ramp for learning was gradual and smooth.

Next post

Fast forward to 2005. In the intervening 26 years, computers have become many thousands of times more powerful. What is considered a "fun computer game" has changed enormously. Kids have been exposed to highly complex three dimensional computer games by the time they are 5 years old. They take CD-ROM multimedia cartoon games for granted.

At the same time, the art of programming a PC has grown from a little hobby to a huge profession. The standards of quality are high, and the modern tools for programming are complex. For example, the professional tool of choice, C++, is a beast of a language, and you can pay Microsoft or Borland hundreds of dollars to secure a copy for your PC.

Everybody owns a computer, but has anybody programmed theirs? Will there ever be another generation of programmers like the ones who were growing up in 1979? Is there any room for a 6-year-old hobbyist?

Maybe there is. But "COMPUTE!" magazine has long since gone out of print, so in 2005 we will need to bushwack a little bit more than we had to in 1979.

There is still a way to hack like a beginner, and we can still have fun.

In the next article I will talk about Anthony's experience in programming my modern 2005 computer as a total beginner.

Posted by David at July 27, 2005 07:30 AM
Comments

It's amazing how closely your experience mirrors mine, right down to the platform - Atari 400/800. The Atari Basic interpreter is what infected me with the programming bug.

My only question is - Are Dennis Yee's fingers as bent as mine are from attempting to type on that godawful Atari 400 membrane keyboard? :)

Posted by: Anonymous at August 1, 2005 03:07 PM

Beautiful - It echos my childhood as well (except I was an apple junkie over atari) and it seems to me that programming has become more distant to kids these days. In fact I still have one of each old apple computer and like to go back to tinker with the 6502, my first real love!

Unfortunately, my kids don't view programming as a very exciting choice of career... ;)

Posted by: Mike J at October 12, 2005 09:31 AM

Spectrum Z80 was my thing back home in India :-)
Each keyboard key had a basic command so you didn't really have to type out the whole FOR loop etc.
Hours drooling over those glossy British computer magazines...
Loading games through a tape machine..
Discovering PEEK/POKE and how fast assembly programs ran compared to BASIC ones...
Being wow'd by a 3-d maze game...
Thanks for a nice post.

Posted by: anon at November 28, 2005 05:28 PM

I especially like how you've captured the white text on blue look of the atari editor (and how trivial the HTML is to capture that look :-). I also got started on an Atari 800. As for an earlier commentor, I picked it out over an Apple II because I liked Atari's editor better for the cursor movement.

Posted by: at June 6, 2006 06:17 PM

http://www.groklaw.net/article.php?story=20071223132431291 and in particular http://blogs.cnet.com/8301-13507_1-9837995-18.html cover guess the number on the OLPC.

Posted by: James at December 28, 2007 04:58 PM

Hi David,

I'm with Manning Publications (www.manning.com) and I'm coordinating some marketing/publicity reviews.

Our author has recommended you as a potential reviewer for Hello World! Programming for Children and Other Beginners (www.manning.com/sande). The book is written by a programmer, Warren Sande, and his son Carter. It's an easy, fun, and visual book, stripped of "geek speak." The book is the perfect tool for teaching programming at home or in the classroom.

If interested, could you shoot me an email?
Hope to hear from you soon. Thanks!

Steven Hong
Marketing Coordinator
Manning Publications
www.manning.com

Posted by: Steven at October 24, 2008 04:54 PM

https://www.christianlouboutinshoessaleoutlets.us/
https://www.ferragamosshoes.us.com/
https://www.fitflop-saleclearances.us.com/
https://www.nikeair-max270.us.com/
https://www.adidasyeezys-shoes.us.com/
https://www.yeezy500boost.us.com/
https://www.balenciagasneakerssale.us.com/
https://www.pandora-charmssaleclearance.us.com/
https://www.outletmonclers.us.com/
https://www.christian-louboutinoutletsale.us.com/
https://www.longchampoutlet-onlines.us.com/
https://www.hermesshandbags.us.com/
https://www.stan-smith-adidas.us/
https://www.airmaxs97.us.com/
https://www.nmds-adidas.us.org/
https://www.puma-outletstore.us.com/
https://www.red-bottomshoesforwomen.us.com/
https://www.pandora-braceletcharms.us.com/
https://www.golden-gooses.us.com/
https://www.asicsshoes.us.org/
https://www.hermesbelts-outlet.us.com/
https://www.christianlouboutins.us.org/
https://www.nike-airmax98.us/
https://www.yeezyshoess.us.com/
https://www.yeezys-adidas.us.com/
https://www.goyard-bags.us.org/
https://www.pumas-shoes.us.com/
https://www.pandoraoutlet-online.us.com/
https://www.asicsoutletonline.us.com/
https://www.balenciagasneakerss.us.com/
https://www.fjallravens.us/
https://www.ferragamobelts.us.com/
https://www.nikesneakersformenwomen.us/
https://www.boots-timberlands.us.com/
https://www.airjordan-retro11.us.com/
https://www.nikecortezs.us/
https://www.adidasstan-smith.us.com/
https://www.adidasoriginalssuperstar.us.com/
https://www.adidassuperstarsshoes.us.com/
https://www.asicsshoesoutlet.us.com/
https://www.fjallravenkankenbackpack.us/
https://www.pandora-jewelrystore.us.com/
https://www.ultra-boosts.us.com/
https://www.new-nikeshoes.us/
https://www.shoes-valentino.us.com/
https://www.adidassneakers.us.com/
https://www.bottegasveneta.us.com/
https://www.lebron16shoes.us/
https://www.asics-runningsshoes.us.com/
https://www.timberlandworkboots.us.com/
https://www.christianslouboutin.us.com/
https://www.adidasstores.us.com/
https://www.airmaxs-270.us.com/
https://www.skechersgowalkshoes.us/
https://www.nike-runningshoes.us/
https://www.pandorabracelets-charms.us.com/
https://www.christian-louboutin-shoes.us.org/
https://www.adidas-eqts.us/
https://www.nikeoutletonlineclearance.us.com/
https://www.air-max95.us.com/
https://www.airjordanshoesretros.us.com/
https://www.lebronjamesshoessale.us.com/
https://www.pandorajewelry-site.us.com/
https://www.nikeshoesshop.us.com/
https://www.valentinos.us.org/
https://www.pandorabracelets-clearance.us.com/
https://www.pandoranecklaces.us/
https://www.shoesyeezy.us.com/
https://www.kevin-durantsshoes.us.com/
https://www.fjallravenbackpack.us/
https://www.yeezyboosts-350.us.com/
https://www.adidas-yeezysshoes.us.com/
https://www.red-bottomheels.us/
https://www.ferragamo-shoes.us.org/
https://www.red-bottomshoeslouboutin.us.com/
https://www.adidasultra-boosts.us.com/
https://www.pandora-rings.us.org/
https://www.airjordans-sneakers.us/
https://www.adidas-superstars.us/
https://www.nmdr1adidas.us.com/
https://www.valentinoshoessale.us.com/
https://www.nmds-adidas.us.com/
https://www.christianlouboutins-outlet.us.com/
https://www.adidas-shoesoutlet.us.com/
https://www.nike-airmax95.us/
https://www.nikes-sneakers.us.com/
https://www.ultra-boost.us.org/
https://www.pandoracharmssales.us.com/
https://www.nike-outletstores.us.com/
https://www.adidaseqtsupport.us/
https://www.kd11shoes.us.com/
https://www.airmax270s.us.com/
https://www.filashoessale.us/
https://www.vansshoes-outlets.us.com/
https://www.louboutinshoess.us/
https://www.timberlands-outlets.us.com/
https://www.pandora-earrings.us/
https://www.airmax-98.us.com/
https://www.adidas-original.us/
https://www.filadisruptor2.us/
https://www.timberlands-shoes.us/
https://www.yeezysneakersboost.us/
https://www.christian-louboutins-shoes.us.com/
https://www.filasneakers.us/
https://www.yeezysboosts.us.com/
https://www.nikesclearance.us/
https://www.yeezy-supply.us.com/
https://www.goyard-handbags.us.org/
https://www.shoes-yeezy.us.com/
https://www.yeezyscheap.us.com/
https://www.yeezysneakers.us.com/
https://www.christian-louboutins.us.org/
https://www.nikeoutletstore-onlineshopping.us.com/
https://www.adidas-nmds.us.org/
https://www.nikeshoesonlines.us.com/
https://www.michael-jordanshoes.us.com/
https://www.timberland-outletstore.us.com/
https://www.timberlands-shoes.us.com/
https://www.nikecortez.us.org/
https://www.nikestores.us.org/
https://www.nikeair-max270.us/
https://www.jewelrycharms.us/
https://www.pandorajewelry-officialsites.us.com/
https://www.pandorajewellerys.us.com/
https://www.yeezy500.us.org/

Posted by: Anthony at January 5, 2019 08:59 PM
Post a comment









Remember personal info?