-
Archives
-
Categories
- Anime (72)
- D&D Campaign (84)
- DM of the Rings (156)
- Escapist (319)
- Game Design (69)
- Game Reviews (314)
- Lets Play (78)
- Links (210)
- Movies (208)
- Nerd Culture (135)
- Notices (82)
- Personal (114)
- Pictures (114)
- Programming (21)
- Projects (88)
- Random Thoughts (123)
- Rants (149)
- Tabletop Games (62)
- Video Games (135)
-
RSS Links
-
Links
Sierpinski Triangle
Previous in Programming: “New” Posters | Next in Programming: Example Code |
When I was about 15 years old, I ran into the following set of directions:
- Take a piece of paper.
- Mark 3 dots on it. They can be anywhere, but for aesthetic reasons it is common to pick three points that will form an equilateral triangle. Number these points 1 through 3.
- Get yourself a 3-sided die. (Or use a d6 and divide by 2.)
- Begin at one of the corners. This is your “current” position. Roll your d3, to select one of the points. Measure the distance between your current position and the chosen corner and put a dot at the exact halfway point between the two. This is your new current position.
- Sit there for a few hours or days repeating step #4: (Your current position moves, pick a corner, move halfway from where you are to the chosen corner, and make a dot, etc.) For best results, use a good ruler and a nice sharp writing instrument.
When I heard this at 15, I expected that what you would end up with is a mass of dots in the middle of the paper, dense in the middle and thinning out towards the edges. This is not what you get at all. In fact, as long as you follow the directions you will never ever place a dot anywhere near the middle of that triangle. What you actually end up with is a Sierpinski Triangle:
![]() |
This was my first exposure to order from chaos, and it fascinated me. It’s a fractal, meaning there is no limit to how much detail the final image can have. No matter how massive your paper is, how fine you make your dots, there will always be yet another level of even smaller triangles beyond the ones you can see at the resolution you’re working with. The Mandelbrot Set was the pop star of fractals during the late 80′s, appearing on Trapper Keepers, pencil holders, lunchboxes, and the like. It is indeed an interesting thing, but I was always more awed by Sierpinski Triangle for the incredibly surprising and simplistic method of generating them.
Obviously generating Sierpinski Triangles is a job best left for a computer. (Or people with out-of-control obsessive-compulsive disorder.) Which is what made me think of it yesterday during our discussion of random number generators. My very first implementation of the Sierpinski Triangle was written in BASIC, using the random number generator that came with the language, and this was the first time I found out what pseudo random was all about.
The implementation I wrote had an odd defect: The area around top-most point would get filled in far, far faster than the area around the left or right points. Likewise, the left-most point was filled in faster than the right, which rarely got any dots at all. (Back then computers were so slow and the resolution so coarse that you could see the dots appear at the rate of only a few a second.) I’d leave the room for 15 minutes, and when I came back I’d have an image much like the one above. But during the beginning stages the problem was easy to see: The first point got lots of dots, point #2 got fewer, and point 3 got hardly any at all.
It turned out that the random number generator I was using tended “low”. Low numbers were, for whatever reason, more likely than high numbers. I did find a way to compensate by making a sort of slow and hackish “curve”. Rolling a one would select the first point. Rolling a two or three would select the second point. And rolling a 4, 5, 6, or 7 would select the third point. Using this, I managed to get the thing to fill in just about evenly.
Looking back, I can think of a number of better tricks I could have used, but at 15 I didn’t yet know about bit-wise shifting or modulo. (And, I’m not even sure they were available in those early versions of BASIC.)
Yes, am am overcome with a sense of nostalgia over a bit of 80′s computer code. This is far more healthy than the way some people are getting all nostalgic for 80′s fashions.
Question for the coders out there: What was the first program you wrote yourself? No, I don’t mean “Hello World!” I mean the first time you struck out on your own and wrote something on purpose. (Mine was a primitive coin-flip game, on my first computer.)
Previous in Programming: “New” Posters | Next in Programming: Example Code |
1
2
Next »
1
2
Next »
96 comments:
2 Trackbacks
-
[...] husband it was programming his best friend’s computer then saving up for his own. In fact, for a lot of other programmers it was the same way. (The link is to my husband’s blog, read through some of the comments on [...]
-
[...] your current position and the corner you randomly selected. Make a dot. Repeat 100+ times. What pattern emerges? Bonus: Write a script for a computer to do this for you and save yourself a lot of work. Then [...]
Leave a Reply

Hmmm, now that’s a tricky question. I wrote a few small ‘educational games’ for friends – number matching, mathematical tests, that sort of thing on a BBC, and I typed in a lot of listings…
The first thing I ever recall really properly sitting down and writing was, oddly enough, after I’d finished my computer courses and knew how to write… I sat down with an old Toshiba T-1000 laptop (Which was old when I used it then, in about 1999, and as I’ve still got it is ancient indeed), and wrote a simple card-shuffling/sorting algorythm. That taught me a lot about code optimisation – running on a 4.77Mhz 8086 processor tends to do that ;)
I went through sorting and shuffling algorythms, and eventually made a passable black-jack game; but I was always more interested in the code than the game itself.
Somehow I’ve gotten away from my coding roots (Now I work installing Microsoft CRM; there is coding, but mainly bitty bits of javascript and SQL), but I still remember that black-jack game :D
The first program I could remember, that wasn’t out of a book, was in BASIC on the C=64. It printed a crude little man using the C=64 characters, then with some control character I brought the cursor back to the top left of the screen and drew another crude little man over it but in a slightly different position, and so on, creating a kind of animated cartoon. Not much real coding to it but then I was only 10 or so, 12 at the most.
Later on I learned about GOSUB to reuse scenes.
Good times, good times.
The first thing I wrote was a robot for a primitive http://www.robotbattle.com/ I wanted something that’d stick to the edges but jump in to grab cookies in the middle. Then my sister wanted one that went in perfect circles so I wrote that as well. My first true program outside of someone elses framework was probably when I decided to rewrite the battle system from final fantasy, no graphics, all text output, but the same turn based gameplay.
I wrote a free steno dictionary builder called Bozzy (after James Boswell, Samuel Johnson’s amanuensis. Helps you build your dictionary, geddit?) in Python about two years ago, spurred to righteous wrath by programs that cost almost $300 per 10,000 words. Bozzy was compatible with any list, but also worked with free corpus files of 80,000 words or more. It just drove me insane that people could be making so much profit off of something so simple I could implement it in less than 100 lines of code. Unfortunately, it’s my only program to date. I eventually want to write a whole open source steno program (significantly more complicated), but I’ve got to get serious about learning Python. I hired a tutor and I’m starting from the bottom up. It definitely makes me wish that I had started programming in my teens, like my brother and most of my friends. Learning how to do this stuff is way harder at 27 than it would have been at 17.
The first (moderately) serious thing I ever wrote was a D&D wizard spell database (2e) along with a handy currency conversion utility in VB for a summer class I was taking at the local college. I don’t think I wrote anything particularly memorable between that and my attempt to learn C, where I ended up implementing Conway’s game of Life. I should take a crack at that triangle; never new they were so easy to make.
Obligatory (not really NSFW) reference:
http://xkcd.com/95/
Hmm. It’s hard to remember back that far… When I was about 10, I wrote a BASIC program that, when I ran it, simulated a starship’s “All Hands On Deck!” emergency announcement, complete with siren (well, beeping) and a flashing screen. And then when I pressed a key, it would select (pseudo-randomly, though I didn’t know about the pseudo- part then) one of three or four emergency scenarios to tell me about.
(My dad’s computer desk setup bore a striking resemblance — in my imagination, at least — to the bridge of the Starship Enterprise.)
But I did the Sierpenski Triangle one, too, when I was introduced to the idea in college. (I wrote that in Pascal, which is the language I was taking at the time. It randomly selected the three starting points, in fact, but since I only had text to work with, drew the triangle with asterisks.)
The first thing that I wrote that wasn’t required for a class was a program that would allow you to enter data for simultaneous equations (as used in electronics) to find current flows. It was written in C and because the circuits could be any size (with any number of equations), I needed to use double pointer arithmetic throughout the entire thing.
Oh, “not required for a class” but I still wrote it for one. I used it to check my math (since I wouldn’t have had access to it on a test).
It was fun. It was education. And I still have it after 15 years.
–Kev.
In case anyone here hasn’t heard it…check out the song “Mandlebrot Set” by Jonathan Coulton.
You can find it here, it’s the first song in the “4 Geeky Ones” section near the bottom of the page.
http://www.jonathancoulton.com/primer/listen/
Most of my early programs were written before I had any programming classes and really understood how code worked.
That said I was quite adept at writing the flavor of BASIC used by my TI-85 in highschool. We made little games like “clip the right wire on this bomb or it will explode”. Basically you hit F1-F5 and it compared to a random number. Choose right and you win, chose wrong and the screen filled in black.
I also was pretty good at writing “solve for X” type programs to help cheat in math class. This was before I really understood how the “solver” function on the calculator worked. They understandably didn’t want to teach us that function until we were finished with Algebra and moved on to Calc.
The first one I wrote by myself was on the C64. I was 9, I had just got it for Christmas with a whole box of games (kids down the road were getting a NES), and everyone expected me to spend half the holidays playing them. Instead, I spent my holiday making an animated creature in BASIC. It would fly around the screen, grow hands and hair, hold up a sign with a very short message (it could only fit a few letters). I wrote it out on paper initially*, testing parts of the code as I wrote them.
Entering the program was problematic towards the end as I gave it more and more behaviour – I used sprites, and every state had to be entered as a series of DATA commands at the end of the program. Time was a major issue as I only had about 4-6 hours between turning the computer on and the transformer overheating and producing some really screwy behaviour.
I tried making music with it, but the legendary sound chip (SID?) in the commodore 64 failed to impress me.
*saving was in theory possible, but you recorded your program on tape and over half the time it would be corrupted. Looking back now, I realise it was probably because I was using rubbish tapes.
The first program of any substance I wrote found roots for quadratic equations. It only worked under the assumption the roots were real (if it gave an error I just did it by hand). This was on my TI-82.
<shameless-plug>
My first program of substantial size is something I still develop, though it’s in desperate need of re-factoring. It is also probably of interest to this group:
http://d20tools.sourceforge.net
I recommend the svn. My last release only works with gtkmm-2.0, so it doesn’t built on many modern distros…
</shameless-plug>
The first program I wrote was a Visual Basic educational ABC matching program. Letters in the alphabet up top would become bolded, and you’d have to select their upper- or lower-case counterparts out of a randomized sea of crudely-drawn fish. I actually still have the program around, although it seems to be a bit unstable on XP.
Just a useles trivia – if you wanted to write the name exactly as it is written in Polish that would be Sierpiński (that’s “n” with sort of a comma on top) – Turns out there even exists a Wikipedia page for it.
I skipped the really basic BASIC. The Sinclair ZX Spectrum – my computer of choice back in the 8-bit days – came with a version of BASIC that was almost idiot-proof, and had an instruction manual to match (stored on the internet for all to see here), so after playing around with that and getting my head around the concept of arrays, I went straight to writing a text adventure game based on Aliens. I was 14 at the time, it was based on what I remembered seeing of the movie when I wasn’t hiding behind the sofa, and it was as simplistic as anything, but dammit, I was proud of my work and played it for weeks.
Project #2 was a shameless knock-off of the Apple ][ game Taipan, which went one step further and even incorporated some machine-code routines to implement a GUI of sorts (although I didn’t write that part – it was lifted from a Spectrum magazine).
I still have both of them about the house, but sadly no Spectrum anymore to run them on. One of these days I’ll have to find a way of getting the old tapes into an emulator. To my shame, I haven’t written anything since…
I was so proud of myself for “hacking” Hamurabi on my buddy’s brand new TRS 80 and changing all the names to dirty words. (Nearly 30 years ago…) Unfortunately my mad skilz pretty much stop there.
I could draw a picture of a programmer though!
I wrote a lot of things with purpose that I don’t remember. Most of my C64 stuff was just copied and modified from RUN magazine. I still remember typing in lines and lines of DATA statements and never really getting anywhere.
The first really useful program I remember writing analyzed your disk (file by file) and determined what block size you should use. It basically calculated how much space would wasted with each block size as well as providing the average number of blocks per file. I ran it a few times and then never looked at it again.
It’s may not be exactly my first program, but it is the first program that I wrote without a lot of help, without copy/pasting stuff I did not understand and which had a point: I wrote a mod for http://www.clonk.de , a german game somewhere between settlers and worms. The mod was huge, not only for my knowledge, but also compared to what everyone else was doing. It is still around, other people have updated the script multiple times and ported it from version to version. It is called DSA, if you care ;) Took me roughly a year (besides school, obviously) and was a team effort of three people. I was 18 when I released it in december of 2000. Anniversary around the corner :)
Guess what I did: I converted that game to an RPG. And I had talents which functioned as they do in Diablo II or WoW, which were released years later. I am so proud! ;)
My first program was a computer versions of these “How greedy are you?”-style “psycho-test” found in German Mickey-Mouse-magazines at that time, when I was 8-9-ish, in GW-BASIC.
Of course, all them were hard-coded at first, because it didn’t occur to me until later to write the test data to files and let the program read from them… :)
My 1st coding experience were using LOGO on the Apple II in 1982 or something like that.
My 1st self coding attempt was after browsing through a Beagles Brothers pamphlet that my father received in a convension I think.
The next “application” I actually wrote was some sort of an Ultima III editor that used code samples from A+ magazine (IIRC).
Oh god… Nostalgia and Apple II… I should quit now…
Fun fact: I used to doodle Sierpinski Triangles on my school notebook. Not using a random point method, just subdividing equilateral triangles until my 0.5mm pen couldn’t take it. :-P
The first programming I ever did was a Choose Your Own Adventure game in BASIC. I promptly forgot about coding for ten years.
Mine was a TI-81 (later TI-83) BASIC program that solved quadratic equations. There’s nothing particularly special about that, lots of people do it and call it their first program, but I was particularly proud of mine because it was shorter than everyone else’s.
At a time when people usually did things like display the q.e. format (ax² bx c=0), or printed out decidedly inane messages like “The answers are [...] and [...]“, or added all kinds of other crap like telling you how many solutions there were, whether they were real or not, etc, mine had no bells or whistles. If you were still in Real mode, it could cause an error, because the program didn’t change number modes.
The batteries and back-up battery in my TIs have long since died, but I think I can remember the whole program:
:Prompt A,B,C
:D←B²-4AC
:Disp (B √(D))/2A
:(B-√(D))/2A
The breakthrough came when I realized that the program would automatically print out the last expression evaluated, and that it would save two bytes to compute the discriminant once separately instead of using the whole formula both times.
The people who were nerdy enough to appreciate such things were impressed with my terseness. Needless to say, I am today a BSD Unix nerd, and while I don’t code professionally, about a year ago I wrote a hex dumper in PPC assembler. Although not as full featured, my compiled program was smaller than the code for several open-source hex dumpers.
I’ve never been much into programming, but I have been in a few programming classes mainly for course credit. I do remember writing a code to calculate satellite orbits for Earth. It wasn’t for the class, although it was written during the class. I made it using pascal. The teacher didn’t mind, since he also teaches physics and I didn’t really have anything else to do.
My first programs (on C64 BASIC) were always choose your own adventure style games. Incidentally, my VERY first program was not “hello world”. I didn’t learn about that standard until my first year of university. Nope, this was what I wrote:
10 ? “/\”
20 GOTO 10
I learned some BASIC programming on an early Apple II model when my mom sent me to a class hosted at an Apple store. But unfortunately we couldn’t afford a computer, so it was several years later when I was well into high school before I had my own computer – a Commodore 64.
I did small programs on there, like drawing a sprite and moving it around, but the C64′s BASIC language absolutely stunk. IIRC, it had no subroutines, or even an ELSE statement.
I once tried to make an ambitious ship-battle game, but the limits of the language made it really unpleasant. The TRS-80 Model III’s in my high school computer class senior year were much better, and I did some small projects on them.
My very first program? Let’s see, it’d be something on the graphing calculator…
I think the very first was a combat simulator with D&D rules. Nothing much, just a basic little thing.
My very first self-written programs were simplistic “adventure games” that were little more than “choose your own adventure” stories. Basically, you would be given a bit of “story”, then you would choose option A or B (sometimes even C or D!). Your options would determine the outcome. Early on, there was one single “correct” path, with incorrect options leading to certain death. These evolved into systems with Hit Points and Magic Points, where incorrect decisions would cause damage, as would fighting monsters, and you could win without making the “right” choice each time.
The most memorable game I made though, was a Visual BASIC version of “Connect Four” that I created for my dad and my little brother. It simply had a button at the top of each column that allowed you to “drop” your token, an indicator showing which color’s turn it was, and a “reset” button that cleared the board and started the game over. It didn’t track victory – you had to do that yourself. Since they usually played on a checkers board (we didn’t own an official “Connect Four” game – my dad was too resourceful/cheap for that!), that wasn’t too big of an issue for them at the time.
Hilariously, the first thing I ever wrote on my own was malware. My C++ class shared a lab with the CAD class, which was full of idiots (appropriately led by an impossibly-stupid instructor), and one or two reasonably intelligent people. Anyway, the intelligent folks decided it would be cool to antagonize us by uninstalling Visual C++ every day they were in the lab. (Looking back, maybe they were just trying to help: ZING!)
Anyway, my preferred brand of vengeance was to write a small program that looped a system beep and printed a warning to stop messing with our stuff, and then hung the system forcing a reboot. I then replaced their usual autocad.exe with my surprise. Let’s see if they notice!
Apparently, the idiot instructor’s response was to unplug everything and flee the room screaming. He was hopping mad, but our instructor was getting fed up with their nonsense, too, so I just got a talking-to about how I’d made things difficult for him. :’P
I wrote a lunar colonization simulator in Fortran on the University of Arizona’s PDP-11. It was pretty weak, actually – with no built-in rand() function and no knowledge on my part of how to write one, everything was deterministic – but it compiled and ran, and at the time (age ~10) I counted that as a win.
First “real” program I ever wrote was a conversation simulator in TI Basic. It simulated a conversation with a specific person I went to college with – someone who talked a lot, but in a very lame and predictable way.
For example, he’d ask what’s your favorite restaurant, you’d name a place (X) that he’d probably never been to, and he’d reply “I hate (X), I prefer the Y” where Y is the lamest possible thing and likely the only restaurant he’d ever been to in his life.
In retrospect, it wasn’t very good, but I was proud of myself. And quite surprised a year later to learn of the existence of ELIZA.
I actually once wrote a GUI program to create Sierpinski triangles. You could choose how many points to plot (up to a certain limit, obviously), where the starting point would be, etc. You could plot in different colors, so early points were, say, black, then red, orange, yellow, through violet and then white. You could also choose to plot in 3D, and you could rotate the triangle and zoom in to ideally see the progression of points over time (turns out that wasn’t a very useful feature, as the points were too close together on the Z axis, and there were far too many of them, to be able to trace the progression.) You could also plot the whole thing as a square, which just filled in (interesting how it works with three corner points, but not four).
Another interesting, sort of off-topic observation about Sierpinski squares: Some research has been done where each corner point of the square is labelled A, T, C and G, for the letters of the DNA code. Then, instead of plotting points randomly, they feed in DNA sequences. Instead of the square filling up as with random points, there are areas that are sparser than others, and some spots that don’t have any points. This tells researchers that there are certain DNA sequences that are fairly common, and others that are pretty rare.
I think i played around with writing stupid adventure games, or finding ways of insulting my brother on the screen (with goto 10 and beep to punctuate it).
in high school i don’t remember striking beyond what i was required to do in pascal. i do remember that I would wait until the due date and grind out all 10 programs that were expected (we did two-week cycles and i’d procrastinate, then grind like crazy)
in college i remember being introduced to visual basic, methods for resizing and moving windows.. well i wasn’t too interested in writing consumer apps(I wasn’t a very good CS student), so I screwed around writing a program to make one small windowframe rotate around another in a circle (i worked by visualizing a rope from the center and changing the x val and then changing the y to make sure the rope was the same length.. i had to write individual routines for the different quadrants, i never really went back and optimized it)
the next thing which was original and mine was when i read neal stephenson’s cryptonomicon. I had to write a little cipher program (five-character repeating shift, pretty lame really)
sadly i’ve always been a dabbler. getting ready to start dabbling again, it’s just a matter of forcing myself to sit in front of the screen and not play games.
I’ve tried to learn Loki knows how many languages (I actually took an elective BASIC class when I was twelve), but the first program that actually did something that needed to be done was when I was dabbling in python and what motivated me was porn:
I had downloaded a comic, which was basically a couple of hundred .jpgs in a folder. However, the genius who uploaded them had numbered them 1.jpg through 300.jpg, which meant it was impossible to just slideshow through them in the order neccessary.
So I wrote an improbably convoluted thing in python to find the longest filename in the folder and fill all the others up with zeroes. That damn thing took me five days to write, and it’s so hackish and filled with weird workarounds you can totally tell that I hadn’t even mastered the basics.
But still, it did what it was supposed to do, and that was a good feeling.
So many old-school programmers, makes one feel like a kid… xD
First program was when I was 14, a text-based Blackjack game on QBasic. Included Fkeys and dual-language. Ah, memories…
I wrote a Sierpinski Triangle generator, much like you describe, on the Timex Sinclair. In fact I wrote several versions of that over the years, the last being on a 386sx in Turbo Pascal for Windows.
In high school I wrote a factorial solver in C with a custom data type that let me go as big as 10^200 and a D&D character generator in Turbo Pascal that used my house rules for my mishmash 1st and 2nd Edition campaign. (Mostly 1st edition) That last one was intended more for generating fleshed out NPC’s though.
Probably not the first thing I wrote, but the earliest one I can remember in detail…
On a VIC-20 sometime in the early 1980s, I wrote a program where you played a bank robber, in text-style (no graphics, that is). There was a street of houses each with their own particular contents and events that could happen within them. Sort of a choose-your-own-adventure type of story. I think I might have pushed the memory capacity of the VIC to the limit with that program, and I think I never quite finished it!
This is going to make me feel really young. My first program was a multi-purpose die-rolling and (for d6 and d10 systems) success calculating program, on my TI-83 calculator during 8th grade math class. It was written in what we affectionately (and maybe accurately) called TI-basic, and it passed the time much better than actually paying attention would have.
The first program that I remember that was not for a class and actually worked, was a search for four positive integers such that the sum of any three was a perfect square. For some math problem I wanted to know if they existed. After finding many results under 1000, I decided that 30 seconds till the first match was unacceptable so I devised and tested every optimization I could think of. I think I eventually got an order of improvement of about 100. I knew someone else that was working on the same problem. Instead of generating only sorted sets he was generating all possible combinations in the range then sorting then removing duplicates.
This was not my first program, but others were for classes I was taking or were grandiose projects that never came to completion (mostly games).
onosson: “I think I might have pushed the memory capacity of the VIC to the limit with that program, and I think I never quite finished it!”
Since the working memory of an unexpanded VIC-20 was right at 3500 bytes (of 5K, 1500-ish bytes were used by the OS), I’d be surprised if you hadn’t run out of space. (Ask me how I know this. 8-) )
My first program that I can remember was on the Vic-20, but it was more of a copy-n-paste out of a magazine rather than myself really coding it (I did manage to put in a few customizations, though).
The first real programs I created were in Applesoft BASIC on the Apple //e, which were either crude graphics screen savers (look at the patters my random bits of code make on the screen!) or similar to Ambience 327 – choose your own adventure games.
Yeah, but it’s not as much fun as being nostalgic over 70′s computer code.
David Ahl…my hero. I used to type those all in, one line after the other. Fun times, man.
You know, I can’t remember. But I suspect it was a “navigate obstacle course left to right”, in BASIC, on the ZX-81. Some sort of game, at least. Not long after, I wrote a “function grapher” (again, BASIC and ZX-81) and tried (note, “tried”, not “succeeded”) to write something to symbolically solve equations, so I could get my homework done faster. I suspect I learned more that way, though.
I wrote a BASIC character sheet for AD&D, complete with ability score (intro to bell curves – yay!) and hit point generator.
It was on an Apple II+, that of the “farting toaster” floppy drive.
My first program was when I was a freshman in highschool (7ish years ago) I took programming 1 which was visual basic. I wrote a program to roll up stats for D&D characters. It would go through the trouble of rolling four d6, finding the lowest one and discarding it. It would of course do this seven times and discard the lowest of all the results. Then it would show them to me. And I just recreated that program in Java now that I’m in a basic Java class in College.
And yes, I realize that these are very simple programs, but I’m not into programming that much. I’m actually going into teaching. This is just plain fun to me.
I wrote an adventure game when I was 13 or so, with graphics. The basic view filled the screen with green dots out to about x=500 (hardcoded, of course), put a flag in the top-left corner, and a red square in the bottom right representing the player. Then there were some stats in the part of the screen not filled with green dots. This represented the dangerous Something Forest which you had to walk through, get to the flag, and back to your starting position. (The flag would move when you got to it.) Every fifty moves you would get a radnom encounter and shift to the combat screen, putting a human(ish) sprite on the left and a monster on the right. (Or sometimes you would meet a peddler who could sell you arrows, healing potions, and so on.) The sprites were all hardcoded as arrays. When you hit a monster with your sword, the upright sword sprite would be briefly replaced with a straight-out sword sprite. Slash! Hack! There was also a bow, and perhaps even magic, but I don’t remember how they worked. All this in Turbo Pascal. It sucked as a game, in that the monsters were way unbalanced and it was more-or-less impossible to win – plus, of course, the top-level screen was basically useless, since nothing ever happened there other than your red square moving around – but it was quite nice for 13 years old.
My first computer, way back in the day, was an Atari 400 which was fairly quickly followed up by an Atari 800 and then a C-64. I transcribed every program I could get my hands on out of BASIC magazine and others and spent days figuring out how and why they did what they did. The first “real” coding I did was actually fixing the code of a ski game – which as written would run, but failed in a nasty way about half the time you ran it (was an issue with a randomly generated Yeti as I recall). I was proud of that as it was a 2200 line long BASIC program and I found the 20 or so lines that were the issue, analyzed them, rewrote them and added another 100 lines of so implementing a new feature (being able to shoot at the Yeti’s). Simple stuff but at the time (1981 – I was 7) it was amazing stuff to me.
Then in 1982 my dad did something he later came to regret. He bought Choplifter for the Atari 800. That was an amazing game at the time. Responsive, reasonable graphics, fun to play… and written in machine code. This of course made me want to learn this machine code. So, I spent the next year and half doing so. This culminated in a game that was sort of a cross between Choplifter and Defender (though I had no knowledge of Defender at the time) and was 100% my own code. As a bonus it had much better sounds than Choplifter – which simply used the same sounds from the Apple II version and completely neglected the much more capable Pokey sound chip in the Atari. I later ported this game to the Amiga and gave it a significant visual (Mandelbrot set backgrounds that pulsed in varying colors was part of it – and yes, it was seizure inducing) and audio upgrade – though the controls never responded quite right on my Amiga. Alas, this code suffered a permanent death in 1992 due to a garage fire that ate the old computers and tapes and disks upon which it lived. ‘Twas good stuff though.
Oddly enough I never went into coding for a living – I’m a systems and network guy now (though I do, of course, do my fair share of scripting and SQL work) and my coding skills are nowhere near what they were as a youngster.
My first program used a now long-forgotten graphics package to draw random circles on the screen in random colors. I found it crashed if I drew the circles partially off-screen, so I had to figure out how to generate them in appropriate positions and with appropriate radiuses.
That was at least the first time I had to think and solve an unexpected problem in programming. I’m happy to say I figured that one out fairly quickly. I just had to make the maximum allowable radius depend on the circles’ center coordinates. Getting it to work did marvels to my beginning-programmer self-esteem, I can tell you that :)
First off, you’d actually end up with the negative of the triangle in your article if you constructed it with the chaos game.
Secondly, I wonder what happens if you start with another shape, and why. It turns out someone’s done it (for some values), and it’s here.
I did a lot of dabble writing in BASIC on my old TI-99/4a, but I think the first program I really set out to write was a simple text adventure.
The effort was crude, though, especially because each room and event was, in effect, a completely separate part in the program; no centralized parser at all. The flaw of the approach became apparent when my brother managed to skip around a few events and ended up with objects he didn’t have because they assumed you had fired the prior event.
I never got over my nostalgia for old coding, I’m still doing it now. (Check my website.) I think it’s because I quit programming for several years in the middle of hobby programming; now I can’t really move forward to a modern system until I finish some things I wanted to do. Fortunately with emulation this is way easier… the old hardware’s a bit tetchy.
Commodore BASIC. A program that would insult you mercilessly. Complete with flashing colored screens and sound effects.
My first program was a Blackjack simulator for the TI58-C (in 1979). I also wrote some kind of lunar lander simulator for that calculator.
My fondest memory from those old times was writing a text-based RISK game with support for up to 6 players, including computer players for the VIC20. The program fudged dice rolls whenever a player named “John” (my younger brother’s name) was its only opponent.