Share Your (Code) Pride

This post is more than 2 years old.

I've been thinking about this for a few days now and I thought it would be good for a Friday morning post. I'm a bit hazy on the exact date, but I have a very clear memory of the first program I ever wrote. (AppleSoft Basic FTW!) I've been writing code for almost 30 years now. I've written a lot of good code. I've written a lot of - um - not so good code. But over all that time, there are certain things that I'm pretty darn proud of. I thought I'd share the code (well, the concept at least) that I'm most proud of and open the discussion to anyone else who wants to share as well.

Back in the early 90s I was big into MUD games. If you are too young (or were too cool) to have played them, just think of interactive, multiplayer online games in pure text form. Warcraft in text. In most MUDs, if you advanced to a certain level you could leave the players game and become a Wizard, or creator. Depending on the MUD you played on, that meant you could extend the virtual world and add new areas, quests, and, best of all, monsters.

Coding in the MUDs I played on was done with a language called LPC. This was a simplistic varient of C. (I say simplistic because whenever I see "real" C code I shudder a bit.) For the most part coding in LPC was pretty fun. You could build a room, describe it, and put a NPC (monster, person, whatever) inside that could interact with players. (Or attack them!)

The last MUD I played intensively was Everdark, a fantasy-based MUD. When it came time for me to build my own zone, I wanted to do something really special. I added two features to my realm that were - as far as I know - pretty unique in the MUD universe. The first thing I did was to add "time" to my realm. MUDs had a concept of time of course. I mean, you walked around. Fought creatures. Etc. But for the most part the world you interacted with was static. If the sun was shining on a castle it was always shining. I wrote a system that created a clock for all the rooms in my realm. My rooms could then return a different description based on the current time. Rooms could also "announce" things to players in the room. So if the room was a beach (think of 'room' in a more generic sense than normal) I could, at 6, mention the sun rise. All in all, depending on how verbose I felt that day, I could be incredibly description.

The second enhancement I created was for the NPCs in my realm. I added basic conversation support. You could go up to Bob and type:

ask bob about weather

At which point Bob might say, "I don't mind the sun so much but I despise the rain." You could then follow up with:

ask bob about rain

At which point Bob could begin to tell you about his knees and how they act up in the rain. You get the idea. The point was that the code was setup to be super easy. I don't remember the exact syntax, but it was as simple as:

addResponse("weather","I don't mind the sun so much but I despide the rain."); addResponse("rain","The rain always makes my knees hurt.");

Adding an alias, like "the rain", was as easy as:

addResponse("rain,the rain", "The rain always makes my knees hurt.");

You get the idea. All in all - I think my realm felt more alive, more interactive, and just more immersive than most MUD quests. I got the code to a point where I could focus on the writing and not the syntax.

I have no idea where this code is now - but darnit - I was incredibly proud of what I created. So - how about you guys?

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by Rick Root posted on 8/13/2010 at 4:39 PM

I don't remember the specifics of the first program I ever wrote, but I'm pretty sure I was somewhere in the neighborhood of 8-10 years old, and it was on my Commodore Pet. Probably looked something like this.

10 PRINT "YOU ARE DUMB"
20 GOTO 10

Very similar to this program I wrote back in the early part of this century..

http://www.rickroot.com/cus...

Comment 2 by Rick Root posted on 8/13/2010 at 4:42 PM

(for the record, this is not code that I'm proud of ;)

Comment 3 by Ed "SteelValor" Sals posted on 8/13/2010 at 4:46 PM

lol Rick I did the same thing only it was more .... colorful

Comment 4 by Dan G. Switzer, II posted on 8/13/2010 at 4:50 PM

One of my favorite days of the month was when my copy of "Run" magazine would arrive. I'd immediately boot up my C64 and test all the snippets of code that were in the front of the magazine (they used to have a bunch of 5-30 line snippets that did something cool.) I'd then set about writing a program around my favorite snippets.

Comment 5 by Jeff Price posted on 8/13/2010 at 5:04 PM

The "best" code I remember writing was for a college programming course. It was an algorithm to build a tree from a pre-order and post-order list. There was nothing particularly complicated about it, but it was the assignment on which I grokked recursion. I have tried to save the code, but 20 years after the fact I'm not sure if it's still with us :(

Comment 6 by Raymond Camden posted on 8/13/2010 at 5:09 PM

@Rick Root: I used to write loops like that on the machines at stores. I remember doing it at a Sears once.

@Dan: Dude, I remember those magazines too, although for me it was Family Computing, not Run, and it wasn't snippets, but pages of code. Hard core typing for a good hour at least.

Comment 7 by Joel Cox posted on 8/13/2010 at 5:33 PM

My first code was in FORTRAN, run on an IBM/360 mainframe, on...punchcards. It taught the novel concept of conditionals and simulated a vending machine. Add 50 cents, buy something for a quarter, get a quarter back, etc. Wasn't exactly interactive like a real vending machine. I had to punch out data cards, add them to the stack with the proper JCL, run them through the card reader, then wait until the geek behind the cage handed me my printout. Still, it was pretty cool to be able to make a computer do what you wanted, and I'm still doing it.

Ray, there is an interactive fiction language (remember Infocom games?) called Inform 7 that looks something like what you've written above. I gotta say that it's one of the most interesting languages I've ever seen.

Example:

The Editor's Office is a room. The desk is a supporter in the Editor's Office.

A red pencil is a kind of thing. 12 red pencils are on the desk.

A letter is a kind of thing. 12 letters are on the desk. Understand "correspondence" as a letter.

Rule for printing the plural name of a letter:
if the listing group size is greater than 7, say "correspondence";
otherwise say "letters".

Rule for printing a number of something (called the target) when the listing group size is greater than 7:
say "[one of]some [or]various [or]an assortment of [at random]";
carry out the printing the plural name activity with the target.

Comment 8 by Adam posted on 8/13/2010 at 5:35 PM

ahhh, aren't we all showing our age :)

A good day out used to be traveling around my local shopping mall doing the 20 got 10's on as many display computers as I could... possibly the first digital graffiti?

I also used to sit for hours with my brother reading out code from magazines, but this was normally in the form of pages and pages of binary. Hours of 0010010... and no way of saving the result....good times.

Comment 9 by Brian Paulson posted on 8/13/2010 at 5:56 PM

@Rick Root: Yeah so remember typing in those programs. I also had the Datasette and would save the programs, ahhhh so much fun back then.

Comment 10 by Tim Cunningham posted on 8/13/2010 at 6:00 PM

Ray, we must be about the same age. I have similar memories. The Infocom games were the best (zork, planetfall, etc..) The old GOTO 10 in BASIC were always fun, but the first coding I did that I was proud of, was a program I put on all the computers in the school library.

It would ask the persons first and last name. This was in a very small rural middle Georgia school so it was not hard to put every person in the schools name into the code. Then the computer would ask, "Would you like to know what I think of you?" Invariably they would say yes. And the "Computer" would tell them something about themselves. Most responses were nice, many were funny, for a select few they were very bitting and bit to close to the truth. Each day I would keep adding new possible responses, so they were not the same every time. Eventually, dozens of kids would be standing around the computer, laughing their heads off.

A few kids got a little "freaked" that the computer knew such stuff about them. This was couple years after the Wargames movie and people had unrealistic ideas about what computers could do.

Comment 11 by Raymond Camden posted on 8/13/2010 at 6:02 PM

@Joel: Yep, I was a huge Infocom fan. I still think "A Mind Forever Voyaging" and "Trinity" are the 'deepest' games ever created.

Comment 12 by Dave Ferguson posted on 8/13/2010 at 6:22 PM

Not that it was actually coding but... I remember back when I was a kid. I would be in stores a play with their display computers. I would do the whole print "something" GOTO 10 generating an infinite loop. Granted back then I had no idea what I was doing. Come to think if it.. not much has changed.

Comment 13 by Saul posted on 8/13/2010 at 6:26 PM

3 hours of typing basic on the rubber keys of my Sinclair Spectrum (16k memory) http://en.wikipedia.org/wik...
Followed by saving it onto compact cassette ;-)
20 minutes to try and load it back off cassette, program loaded about 50% of the time.

Hooked

Comment 14 by David Hammond posted on 8/13/2010 at 6:54 PM

Ah, Infocom. The Hitchhiker's Guide to the Galaxy was my favorite. The original game is available on Douglas Adams' site: http://www.douglasadams.com...

Comment 15 by Joel Cox posted on 8/13/2010 at 7:03 PM

@Ray, I think this subject came up before. I'm with you on "Trinity", not so much on "AMFV". "Ballyhoo" was hilarious.

Comment 16 by Daria posted on 8/13/2010 at 7:18 PM

aaah, typing out programs from magazines on my commodore 64 attached to the little tv that jumped up and down... those were the days

Comment 17 by Tim Cunningham posted on 8/13/2010 at 7:20 PM

@David, Infocom Hitchhikers guide to the galaxy, was fun, but dang impossible to finish. On the plus side I learned a new word "analgesic". Struck me as a dirty way to say asprin.

Comment 18 by Sid Wing posted on 8/13/2010 at 7:24 PM

@Ray - I'll look at adding those to gamefyre.com (AMFV... and Trinity)
@DaveH - and available for online play at the website link for this comment :-)
@Joel - I will try to hunt that up too..

Current list for online play is:
Zork 1: The Great Underground Empire
Zork 2: The Wizard of Frobozz
Zork 3: The Dungeon Master
Beyond Zork
Leather Goddesses of Phobos
Hitchhiker's Guide to the Galaxy
Enchanter

If any of you own the games (in PC Format) and can get me the .DAT files - I can add them.

Comment 19 by Gary Stanton posted on 8/13/2010 at 7:29 PM

I actually think the code I write nowadays is what I'm most proud of, but if we're talking 'Old Skool' it'd have to be the word processor I wrote in BASIC for the Amstrad CPC464 when I was a kid. It was incredibly simple, but it did the job. I managed to get a few different fonts in there and search functionality too.
Another great moment was when a teacher told me there was no way to print in Cobal (Cobal? Really?!), which I then did by outputting the contents of a file to lpt1.

Comment 20 by Raymond Camden posted on 8/13/2010 at 7:32 PM

@Gary: No need to be old skool - it just kinda turned that way. ;)

Comment 21 by Micah Brown posted on 8/13/2010 at 7:55 PM

It sounds like alot fo us started out on those C64's. I still have mine as well as an assortment of vic 20's, c128's and some amiga's (wife loves all that).
My first real app was back in the c64 days and was a little bbs I built as well as a comic book tracking system. Yes I was real popular with the ladies back then!

Comment 22 by JP posted on 8/13/2010 at 8:00 PM

I once spent at least a month writing a finite state machine that did character pattern matching that couldn't be done using regular expressions. I remember being blown away when my code actually worked!!! It took the definition of a character pattern (similar to regex) and compiled it into a finite state machine (a binary tree structure). As the code parsed the data, it was pointing to a "current state" in the machine (or a node in the tree), which determined what to do next. Definitely the geekiest code I've ever written!!!!! But also pretty cool.

Comment 23 by John Ramon posted on 8/13/2010 at 8:10 PM

I've written lots of cool things in ColdFusion, which I must say is my favorite language. But my most memorable code not really my best, makes me smile every time I think of it. It is some code I wrote in PHP, let me explain.

When I worked for a major cable,internet,phone provider we had these systems that monitored the network and a user had to go over it to find problems. This information was all stored in a DB, so I wrote some code to pull it and based of some mathematics it would let the end user know if there was an outage in the system. This made my job easier I just surfed the web till my software told me I had to work. Worked like a charm, I literally did nothing for 3 years till bosses found out and promoted me to work on other stuff.

Here's the really cool part that makes me smile. The code has some javascript in it that when you hit (c) a popup would open up. What opened?

An animated gif of John Travolta doing disco with a midi file file that plays Do the Hustle, with a nice, not so safe for work message.

Why the (c) key well the page has info users need to copy sometimes they miss the control key and my popup opens. I still have friends there and my code is still running and every now and then they say people find it.

Comment 24 by Alan McCollough posted on 8/13/2010 at 8:24 PM

One of my proudest bits of programming was also one of my first. I had a VIC 20, and a 300 baud modem. I cooked up a short BASIC app to sequentially PEEK into a block of memory, and write it over the modem, to the recipient, who would then POKE the info into their VIC 20. I used it to successfully transfer an assembler prog I had hand-keyed in from a magazine. The guy on the other end of the phone had to hand-key in his part of the modem prog, but after that, in a few minutes, he had a copy of a nice space-invader app running, and he was then able to save it off to cassette. Sort of an interactive FTP, if you will. 30 years ago. Whew!

Comment 25 by Heather posted on 8/13/2010 at 8:43 PM

LOL I used to write the best scripts for mud master.

Comment 26 by Aaron Greenlee posted on 8/13/2010 at 9:08 PM

Did you lay L.O.R.D.? I loved that on my BBS before Al Gore gave us the Internet.

Comment 27 by thinman posted on 8/13/2010 at 10:25 PM

Wow. Such luminary code masters. Mine is from more humble roots, made all the more humble, because lots of folks don't consider HTML coding to be real programming.

Remember the Mosaic browser? Netscape v.1? I used to carry one floppy with the browser installer on it, and another floppy with my first web pages on it.

The fact that you could run them in the browser with text and images in tables with all sorts of border thicknesses, text sizes, colors, etc., and they looked and behaved pretty much as intended was magical to me.

My most proud piece of HTML code was the newsletter. Al except the printing part. Forgot about the fact that most folks would need it on paper. Had to head back to the drawing board and find out how to do 8.5 inches in pixels. Six hundred twelve is still a very magical number.

that my story. i'm sticking to it.

the end.

Comment 28 by MikeG posted on 8/14/2010 at 12:06 AM

The first "real" program I wrote was to take wire list data from an AutoCAD program written in LISP by someone else that generated the wire list data and then formatting it in raw postscript to push to a postscript printer on the floor. This is back when a 40MB harddrive was a big deal. After I saw the first published print out of a wirelist from that program, I was hooked and have been programming ever since. It was probably the hardest damn thing I ever tried to do.

Comment 29 by sanoop posted on 8/16/2010 at 2:59 PM

I wrote my first program in C lang when i was in college, it was the addition on 2 numbers and @ the compile time i received 6 compile time error :( ofcourse there was nothing to proud.

Comment 30 by Adam Presley posted on 8/17/2010 at 2:35 AM

I think one piece of code I'm most proud of is a merge field parser for a mass emailing piece of an application I worked with for over 4 years. It was a CF component that took a user's email text, parsed and executed it, then sent out the parsed result.

Although a pretty basic lexical analyzer it supported basic merge (data) fields, commands, and even looping constructs. I believe it is still in use today after 5 years, and no real changes to how it works.

Comment 31 by Jaana Gilbert posted on 8/17/2010 at 5:30 AM

Ohhh the good old times when we didn't have to worry about making a living and the hardest thing was to study for a stupid exam at school hehe. I wrote my first functioning code with an Amstrad CPC 664.. way back when... mid 80's. I was all about archiving everything in my life, so now I was able to archive all my collectables and such with that little computer :)

Comment 32 by Gabriel Landes posted on 8/17/2010 at 7:36 AM

I had no computer as a kid but took a "Computer Basics" course in 7th grade with the Apple IIe and learned a little basic. Our final had to incorporate the basics of Basic - print something, gosub, goto, etc. While my classmates mostly stacked each required element in as few lines as the could to "get it done", I wrote several thousand lines of Basic to create a Choose your own Adventure program (like those books that were so popular). It even featured a map that allowed you to fly a plane by redrawing the "X" everytime you hit one of 4 keys - each time it checked the coords to see if you were over the destination or out of bounds. I was so proud and my teacher was a bit dumbfounded!

Since I didn't have any other exposure to computers, I didn't touch programming again for about 20 years. It was like finding a long lost friend. Now it is my living.

Comment 33 by Marko Simic posted on 8/17/2010 at 7:12 PM

To strengthen up Spectrum league :)
+1 for ZX Spectrum, same as Saul had.
First program I wrote, in 1983, was on that machine, in BASIC.
I rewrote Invaders (if I remember well) from original guide bundled with computer, then some BEEP songs and airplane animation. Damn, I was so proud on myself :))

Comment 34 by Mike posted on 9/3/2010 at 1:58 PM

Is that you Romana? We lost the box that ran Everdark when the co-location went out of business (might still get it back, but it's been a while). I have a few samples of your code if you want them.

All the best,
Zack

Comment 35 by Raymond Camden posted on 9/3/2010 at 3:11 PM

Yep, I was Romana. I'd love to see the code again Zack, thanks!