Sierpinski Triangle

By Shamus Posted Thursday Dec 4, 2008

Filed under: Programming 107 comments

When I was about 15 years old, I ran into the following set of directions:

  1. Take a piece of paper.
  2. 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.
  3. Get yourself a 3-sided die. (Or use a d6 and divide by 2.)
  4. 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.
  5. 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:

sierpinski.jpg

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.)

 


From The Archives:
 

107 thoughts on “Sierpinski Triangle

  1. LazerFX says:

    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

  2. ClearWater says:

    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.

  3. Greg says:

    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.

  4. Fafner says:

    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.

  5. Nathon says:

    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.

  6. Inyssius says:

    Obligatory (not really NSFW) reference:

    http://xkcd.com/95/

  7. Liz says:

    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.)

  8. Kevin says:

    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.

  9. Factoid says:

    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.

  10. mac says:

    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.

  11. pwiggi says:

    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>

  12. Clint says:

    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.

  13. Simplex says:

    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.

  14. maehara says:

    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…

  15. Kevin says:

    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!

  16. yd says:

    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.

  17. Kdansky says:

    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! ;)

  18. DrMcCoy says:

    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… :)

  19. DM T. says:

    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…

  20. Robyrt says:

    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.

  21. Jolly Roger says:

    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.

  22. Moridin says:

    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.

  23. ngthagg says:

    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

  24. LintMan says:

    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.

  25. Ben N. says:

    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.

  26. Ambience 327 says:

    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.

  27. Claire says:

    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

  28. Robert says:

    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.

  29. Maddy says:

    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.

  30. asterismW says:

    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.

  31. Illiterate says:

    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.

  32. kamagurka says:

    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.

    1. WJS says:

      Wow. That’s… a lot of time for a very small payoff.
      6 lines in a terminal:
      for f in ?.jpg; do
          mv $f 0$f
      done
      for f in ??.jpg; do
          mv $f 0$f
      done

  33. Kyte says:

    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…

  34. Tirgayon says:

    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.

  35. onosson says:

    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!

  36. Zimboptoo says:

    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.

  37. droid says:

    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).

  38. Doug Sundseth says:

    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-) )

  39. Groboclown says:

    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.

  40. Rubes says:

    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.

  41. Ingvar says:

    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.

  42. Telas says:

    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.

  43. Gary says:

    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.

  44. King of Men says:

    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.

  45. Stark says:

    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.

  46. Pekka says:

    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 :)

  47. Henry says:

    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.

  48. Adamantyr says:

    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.

  49. Rich says:

    Commodore BASIC. A program that would insult you mercilessly. Complete with flashing colored screens and sound effects.

  50. Zippy says:

    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.

  51. Zaxares says:

    … It was “Hello World!”…

    I’m going to go hide in the corner now…

  52. Bryan says:

    The first BASIC program I wrote was a star trek game on a TRS-80 in radio shack. (I was 16 at the time.) The store owner used to let me program it because people would stop in, look at it, and say, “I didn’t know your computer could do that!” In my game, there were federation, klingon, romulan and gorn ships. The Romulans and Gorns would spit antimatter globules which would explode when adjacent to federation ships. Also, it used 360 control (not to be confused with a 360 controller) instead of letters and numbers.

    My first machine language code was a sprite manipulater for the C-64. I used it in a maze game I got from a magazine so that I could see animation of a man walking instead of just footprints. I still have the C64 and the sprite manipulator.

    Those were some good times, back when programming was simple and 3D was unheard of.

  53. Sylvia says:

    I wrote a fortune teller. Very girly of me. It was just a random number generator with 20 variants of yes, no, maybe. You typed in a question, the screen went black and then you received an answer. I remember, what freaked me out is that my best friend not only loved it, but took it seriously.

    What frustrated me was that I couldn’t do spooky graphics and mood music. This was on a VIC 20 and a cassette tape drive, options were pretty limited.

  54. Jabor says:

    Let’s see… a simple breakout game. I didn’t quite get the collision detection the way I wanted it, and I keep saying “I’ll get back to it and finish it off some day”.

    I haven’t, yet, but it will happen!

  55. ngthagg says:

    Henry: Neat stuff! Apparently you can do these things in 3 dimensions as well (ie, a tetrahedron). What I find interesting is that in 2D, the space inside is a triangle as well. But the space inside a tetrahedron is an octahedron.

  56. LadyDarkWolf says:

    On the VIC-20 I wrote a D&D Character generator in BASIC.

    My next ‘major’ project was a ‘Blitz’ clone for my mother, on the C-64. Basically a plane starts at the top left, and flies right, moving down one row for each pass. The bottom of the screen is filled with building which the plane must bomb. In order to land safely all buildings must be destroyed.

    That was in BASIC and I learned a lot about timing and ‘fps’ type concepts.

  57. anachronist says:

    My first program was a number guessing game, where the computer thinks of a number tells you whether your guess is higher or lower. I wrote it in 1972 in BASIC on a Honeywell mainframe, I think.

    As for Sierpinski triangles, you can generate a similar effect with any polygon arrangement of seed points other than 3. Using 4, you get what I call a “screen”; it looks like an object, but everywhere you zoom in is a gap.

    If you ever downloaded the free Fractint software, check out the stereo 3-D iterated function systems. You’ll find 3-D analogs to the Sierpinski gasket, using a tetrahedron, cube, and dodecahedron. I’m proud to say I contributed those. You’ll need red/blue 3-D glasses to get the full benefit.

    -A

  58. Blurr says:

    My first program was written in C++. My dad’s lab needed to rename a lot of files according to a list, and my program did just that. Looking back on it, it’s horribly structured. >.>

  59. C-Money says:

    Alright…I’ll go ahead and actually break this cycle. I need to ask a question (as I have never used non-hexahedral dice)…how does one have a 3-sided die? That makes no spacial sense. I’ve looked it up, and have yet to find an image of one.

  60. RibbitRibbit says:

    Don’t remember the first one (ZX81? Spectrum? Atari800XL BASIC?) but the first one in C was a math prog that did a Probability curve generator for Shadowrun (1st ed). Factored in weapon stats, # of shots fired, recoil compensation, user skill… a partial but quite extensive one-on-one combat simulator. Ran on a Unix mainframe so I could churn out 100K data points without breaking a sweat.

    Never did write a complete comparison prog (like, say, using a “weapons database”) that would enable me to choose the best weapon ammo cyberware #-of-shots… a pity, actually.

  61. Roxysteve says:

    Fortran IV running on an ICL 1904 under GEORGE III for me. Dykstra’s Algorithm for shortest path through a network was the problem at hand. 1976 was the time and The University of East Anglia was the place. The punch card deck was the source storage medium of choice (of which I was offered only one choice).

    As far as I know the bloody thing is still trying to work out the answer as I type. Or maybe it went “Illegal X” when no-one was looking at the console teletypewriter. I dunno. I gave up and went for a cup of tea thirty-two years ago, and never went back for the results.

  62. T-Bone says:

    C-Money: It’s like a d4, but on one side instead of a face there’s a black hole.

  63. Kris says:

    Mine was a coin-flip program that just let you enter the number of tosses and then scrolled rapidly through the results and gave a final percentage. I wrote it for my … 2nd or 3rd grade science project. Also written in BASIC. Weee!

  64. Kris says:

    The other way I’ve seen D3’s is to take a standard D6 and have 1/2/3/1/2/3. It follows the same basic rule that opposing sides add up to one greater than the total number. so 1/3 are opposite, 2/2 is opposite, and 1/3 is opposite again. So you can take a Sharpie and make a normal D6 play double duty as a D3.

  65. Alex says:

    “Get yourself a 3-sided die.”

    I’m having a very hard time picturing dice, or any object, with only 3 sides. The closest I can think of is something almost pyramid shaped, but that’s not including the bottom.

    I’ve got to be missing something here. I’ll probably feel like a huge idiot once I figure this out, but right now this is really bugging me…

    T-Bone- Wouldn’t the inside of a 4-sided dice with a negative space just have its own inverse “sides”? Wouldn’t that then equal 6 sides?

    I’m so confused. =(

  66. Nathon says:

    People make D3s that are essentially triangular prisms with the ends pointed. So it’s actually more of a 3+infinity sided die, but it’s very unlikely that it will land pointy side down on Earth.

  67. Ken Zieger says:

    Wow… C-64.circa 1981 or so: I wrote an address book, merger, envelope print program. All the addresses had to be hard-coded because everytime I tried to save them in an array, they crashed.

    Gods, I wanted it to load with anything other than a ‘*’.

    And, yes, I also wrote an adventure game similar to Zork. But with 100% more juvenile humor!

  68. Ben N. says:

    Also: for the longest time I thought that the random thoughts icon was a guy sitting at a computer, he’s colored white along with the desk and the background is purple. I only just now noticed that it’s a question mark.

    D’oh.

  69. Maddy says:

    Dammit Ben N, now all I can see is that guy sitting at a computer, and I can’t see the question mark at all! Thanks a lot! How am I going to drive home with my eyes all screwed up like this??

  70. DrMcCoy says:

    There’s actually an US patent for a 3-sided die: US Patent 6042116

    1. WJS says:

      Good ol’ US patent office! Issuing patents for thousand-year-old inventions to this day!

  71. Downtym says:

    A blackjack game in Apple IIe BASIC. I used standard casino rules for the dealer, allowed up to 6 hands per play, arbitrary number of standard card decks (this will be important in a second), players could split, double, bet, buy insurance, etc., players could determine their starting money (the bank had infinite money), and the dealer could be set to randomly shuffle or shuffle after a number of predetermined deals.

    The entire purpose? To teach myself how to card count.

    My programming teacher didn’t get it. It would have been nice if she had thrown a probability book at my head.

  72. Henry says:

    ngthagg: The octahedron-in-tetrahedron presumably results from the vertices being at the midpoints of edges. I wonder what happens when you try a cube, or a dodecahedron (hey guys, d12 reference!)

  73. R4byde says:

    My first experience with programming was a little program in BASIC I got out of a magazine, about 10 years ago. It drew a simplistic space shuttle and you had to give it the correct mixture of fuels for it to reach orbit. The only problem was that in the magazine they had intentionally added a few bugs, and my nine year old head nearly exploded trying to find them. I finally just looked through all 149 lines individually. That experience made me hate debugging.

    The first program I wrote by myself was a little pac-man clone about five years ago. I had to get a lot of help before I could finish it. After debugging that I decided there was no way in hell that kind of frustration was something I wanted to experience on a daily basis, too much like solving higher math problems. So now I’m studying IT, sooo much easier. :)

  74. Kacky Snorgle says:

    Three-sided dice:

    http://www.gamestation.net/category/2584203141/1/3Sided-Dice-d3.htm

    (Not intended as advertising, just the first search result that had a photo….)

  75. neminem says:

    It was certainly at a “learn to program” type summer camp… the first program I wrote that did anything more complicated than just take input from the keyboard, eat it, then print out some other thing, was probably a dinky little painting program, in a dinky little basic variant called TrueBasic. The first program I wrote that actually did something useful, was a integer factorization thingy in TI-basic, cause I wanted one, and the 83 didn’t have one.

    I didn’t really write anything that did anything nifty until college sometime. I like programming, but it was work, and playing video games wasn’t, so I mostly just did it for classes. And class exercises, until about halfway through college, tended to be little dinky things.

  76. Cuthalion says:

    My first program outside of class was probably the battle system & party management toolk I wrote in Java for my homebrew tabletop RPG. It’s a text-based, command-prompt utility that crudely reads and writes to/from disc so you can save multiple parties, complete with their current numbers and enemies with theirs. And you can tell it to have one character attack an enemy, or vice versa, and it’ll either autocalc the rolls and damage, or have you put in the numbers you’ve rolled on your own dice and tell you the damage.

    I’ve since adopted that via the RPG Toolkit to make a graphical CRPG battle system. It works, with only a couple glitches.

    The second program I made on my own was probably a word generator for a language I’m making. It spits out random syllables that follow the possible sound combinations in the language, then it slaps a random number of them (weighted towards lower amounts, iirc) together. It spits out 50 of these every time I run it, then I just glance through for ones that could actually be words (the syllables don’t always flow well) and use one that I think sounds like the concept I need a new word for.

    Since then, I’ve done a ton with RPGCode (see the toolkit link) to make my battle system. But that system got started with the one I programmed in Java.

    Edit:
    Ooo, wait! I think the actual first program I did was one that had something to do with prime numbers. I can’t remember exactly what it did, though. I did it on my own, but during my web design class (we spent maybe one day on php and I made it as an experiment). That was probably the first time programming ever made any sense to me.

    Edit again:
    I also wrote a java program to randomly spew lower-case letters until the last several letters made a predefined word. I found out that while it spit out “cow” and “poop” almost instantly, it takes a very long time just to get it to randomly generate “shakespeare”. In fact, I had it running for hours and it never finished. Based on that intriguing (to me) dillema, I calculated how long it would take a trillion monkeys to randomly type out the text of Hamlet, with all punctuation and spaces omitted, and all letters lowercased.

    Yes, I am a nerd.

  77. MaxEd says:

    I can’t quite remember my first own program on ZX Spectrum, buy my first PC game, written in QBASIC during boring Russian Literature lessons in school was Text Adventure (with short description of situation and variants of answer, not with parser). It was a godawful mess of GOTOs and PRINTs and was named “Castle of Horrors: Part I”.

  78. Avilan the Grey says:

    I am extremely impressed by the extreme talent of a lot of people in this thread!

    I have always been more of the “use someone else’s program” type than to try to make anything myself. I am lazy.
    I am also not that talented, or maybe I am just TOO lazy. The few times i have done programming that did more than

    10 PRINT “PLEASE TURN ME OFF!”
    20 GOTO 10

    has been in various computer classes over the years and I do think I have a talent for coding, but I just don’t enjoy it. I was always at the top of my class, solved logical and structural problems quickly (one game I always played was to optimize the code as much as I could before turning it in, aiming for a situation where the teacher would not be able to see what the program did without testing it for himself.) but I have always forgotten everything within a week afterwards. I just don’t find it interesting, so my brain just flushes the information as soon as I got my “A”.

    The only things I remember is “Don’t forget the ;” and “Procedures ends with ()”.

    Over the years I have done BASIC (VIC20, C64), Pascal, Turbo Pascal (IBM PS2), C, C++, Javascript (Modern PCs).

  79. eue says:

    Mine was a little game where you had to land a spaceship on the Moon with a limited amount of fuel. I hacked it up in Pascal.
    It was way before I learned about functions and procedures, so you can imagine how bad that code was.

  80. MrNiceGuy says:

    Centipede on a Sinclair ZX-80. Handwritten machine language on paper, byte for byte, then translated back into ASCII so I could type the code in as a string. Had the BASIC code execute the string (a hack you used to execute machine code on that particular system).

    It actually worked pretty well, ran fast and everything.

    God I had a lot more patience back then…

  81. Nathaniel says:

    Probably the first code I wrote was for the TI-83 in middle school: I and a few friends were building a “master program” to use in our math and science classes, that contained every possible equation we might need. After a few refinements, we got the program to show you every step of the work, and created a main menu where you selected each thing by typing it in.

    Incidentally, this was my first run-in with DRM, as we started selling the program for a quarter, but then people started giving it away for free. We were actually all in favor of somehow requiring a password to copy the program, but we didn’t know how you would do that.

    At about the same time I joined a school robotics team, which I’m still doing in high school, and while I don’t do much programming, I’m forced to do a bit. We use some special derivative of C to program our robot.

    Funny robotics team anecdote: we’re the only “sport” our school is good at, we got 7th and 5th place in the world last year.

  82. RL says:

    I’ve got nothing so prodigous as those who’ve already chimed in, but…

    I think I started out with QBasic when I was 10, on my family computer. Beyond copies and mods, I wrote a very simple 4 room text-adventure, and several aborted attempts at a text-based RPG that I gave up on because I couldn’t make the random function actually generate random numbers, for some reason (to this day, I don’t know why it wouldn’t work). I couldn’t get my hands on a compiler, which is probably a good thing, as I had plans for several amusing (to me) virii.

    At the same time I started tinkering with DOS batch files, and was able to do some neat things with them – for background, I attended school in a tiny mining town. The mines meant our school was flush with cash, so we had computers, but our teachers barely knew how to use them. The start-up routine for the computers included a batch file from the people who set up the network, which after the boot sequence allowed the user to choose between starting Windows, or going to the DOS Prompt (as some programs could only be launched from DOS…), or doing a handful of other things. The problem was that after quiting Windows, you went to the DOS prompt, without any options – so students were directed to Reboot after exiting Windows, so they could get the options again. I was quite impressed with my 10 year-old self when I was able to alter the batch file so that when people quit Windows the options came back. I made another batch file to make the fix, and fixed it over luch break while my computer teacher just scratched his head. In all, I think I made over a dozen batch files to do simple things like that for the school or friend’s computers.

    That, sadly, was as far as I got with anything resembling programming. My entire district was devoid of resources for learning anything about that kind of thing, so I’d pretty much forgotten about it by high school.

  83. C-Money says:

    Thank you for the explanation. The 3+infinity explanation actually made a lot of sense.

    As to my first program, I’m not sure. The first real “program” was probably written in C++, and was some lame assignment for class. However, by that time I’d been programming in Flash for a couple years…though nothing that could really be considered a standalone program…just supporting features.

  84. Rebby says:

    I’m not a programmer, so I can’t really answer that question – but my high school math teacher was obsessed with the Sierpinski Triangle and one of our projects in calculus was to build one out of toothpicks and construction paper. We did like, 3 or 4 levels of triangles and the whole thing stood about three feet tall.

  85. Andy Adams-Moran says:

    This was on my Commodore 64, equipped with “Simon’s Basic”, a cartridge-based expanded basic interpreter (with some nice simple plot graphics commands) written by a 16 year old kid from the U.K. named Simon.

    We’d just been doing single vanishing point plane perspective in “Graphics” (year 10 maybe?), and I woke myself up one night with a ratio-based trigonometric solution to drawing different solids in perspective (cubes, pyramids, rectangular prisms; yes, I know). It was parameterized by the kind of solid, its dimensions, its position behind the plane. It worked pretty much first time. I didn’t know I was using trigonometry, the ratios just made sense. Very satisfying.

  86. Gawain says:

    The first “real” thing I remember writing was a program in GW-BASIC to make a pattern of lights light up on a fixed circuit board. I think I got extra credit for adding music.

  87. resonanteye says:

    DMotR brought me here, but this post has made me into a fan.

  88. Carra says:

    Sierpinski triangles…

    A BASIC program to create them was added in the manual of my Amstrad 64 pc (a C64 clone). Typing that program in was probably one of the first thing I wrote, even if I didn’t quite get what it did.

    One of the first “serious programs” I wrote was a program to draw Lissajous Figures. You could put in the formula parameters and it would draw the figure. I was about 16 then and yes, I had no idea what a function was then. Makes me want to see the old code again.

  89. The first programming I did in 1972 was pretty simple, machine code stuff. Later, I did a random planetary system generator (complete with names) for playing Traveller.

    Things had gone a long way in programming from 72 to 78 when I wrote that. Nothing memorable since.

    As for “Get yourself a 3-sided die.”

    Some of the oldest known dice are three side dice — they look somewhat like the three sided pencils the Indian Nations used to sell.

    Oh, and I guess everyone wrote D&D character generating programs, basically so they could roll the dice a lot of times until they got characters that fit certain parameters. Why that wasn’t cheating …

  90. chuckp says:

    The first non-school related thing I wrote was a program that used the schools’ flatbed plotter to draw hex grids for wargames. Just the thing for an impoverished high schooler. These were the perks of being the first person to figure out how to get the thing to work.

    This was done with a DEC LA36 and (forgotten model) HP plotter, connected to an HP3000 by a 300 baud acoustic coupler modem. Yes, you had to dial a number and place the handset in the cradle to use a computer that was in the next building. (1978-ish)

  91. beno says:

    I invented “text wrestling”!

    It played a bit like a text adventure, but there was a time limit on your response. You had a selection of keys you could press, like “M” for execute a manoeuvre or “R” to run into the ring ropes. I programmed in a couple of dozen of the WWF wrestlers of the day (I think that was back when The Rock was called Rocky Maivia and wasn’t cool yet). You could win by pin or submission, including pin combinations like the Perfect-Plex. I even did a 30-man Royal Rumble version which was bloody hard to win if you drew an early number.

    I’ve just found the source, and this does in fact seem to be the first thing I ever successfully authored and programmed myself.

  92. PhoenixUltima says:

    Hey, it’s the Triforce!

  93. Dan says:

    The first program I wrote was also the first game I wrote – a Pong clone. Mine was in BASIC too – to be more precise, Microsoft QBasic 4.5 – running on a 386 with 32mb of RAM and a 1gb hard drive. I was 13 at the time.

    (Actually, looking back, it was really more of a Breakout clone with no blocks to hit – it was a 1-player Pong since I didn’t really have anyone to play it with.)

    Whatever happened to Pong? There are still implementations of Pacman and Tetris and so forth, but I never see Pong anymore. I have a special place in my heart for it since it’s the first thing I ever wrote.

  94. Ädamas says:

    this may not count but i am writing a find a word solver in python and there was my menu made in .batch but that was just a bunch of if’s stacked on top of each other.

  95. HeroOfHyla says:

    First program I wrote that actually did anything was a QBASIC program where you typed in your astrological sign and it would print out the lyrics for your sign from Weird Al’s “That’s Your Horoscope for Today.”

    Later I made a blackjack game, then stopped working with QBASIC.

    Now I try to make a quick blackjack program in every language I learn. C++ seems to be the most difficult so far, because I’m not used to passing references instead of the objects themselves/etc.

  96. GURU says:

    Yup, my one of the first OpenGL programs was this one!!!!!

  97. Sean Hagen says:

    The first thing I ever coded was a character generator for DND 3.0 in high school. I was in Grade 11, and had already breezed through the entirety of the course curriculum. So I gave myself a project and worked on that for the rest of the year.

    It was two page Perl CGI script. The first page you’d select a few things, like race and class, then the rest would sort itself out. It would print everything out, every stat that was dice related, from stats to how much gold you started with.

    Since that was my first foray into writing a ‘real’ program, it was a mess. Which was ( upon reflection ) made even worse by my use of Perl. Now I’m not saying Perl is a bad language, far from it. It’s just that it’s very easy to write unmaintainable code in Perl, especially when you’re just learning how to program.

    But I was SO proud of this little program. It was a horrible mess of if statements, but it worked ( mostly ). I’m kind of sad that I lost track of the source code over the years. I’d really like to go back and take a look at the first thing I ever wrote, to see how far I’ve come — that is, if I could read the source code.

  98. Carra says:

    The random solution is a good one which gets the job done. No reason to dis it now.

    As for my first program? Mmm, my first serious program must have been a program to draw Lissajous figures when you entered the equations when I was about 16.

    Also, drawing a sierpinski triangle was actually a two page explanation in the user manual. Back then the manual still had some use :)

  99. Carra says:

    Euh, double post with about 3 years between them.

  100. Gilf says:

    Being a massive min-maxer, and having been raised with C and C++, I actually started off on my own with a damage calculator for Final Fantasy Tactics, which would produce two sets of ranges: one for regular hits, the other for criticals.

    Eventually, I abandoned the project before it was complex enough to differentiate between different abilities (I wrote it assuming I would just use a basic ‘attack’ command), but now that I remember it, I’m pretty proud of myself. Looking back, I suppose I was a power gamer long before D&D gained my notice.

  101. Lee says:

    I can’t remember my first program. The first one I can remember was a simple addition / subtraction quiz program I wrote on the C-64 at school. I wrote it for a former teacher who had C-64s in his first grade class, but no decent software for them. What I wrote was really basic (pun intended) but it was fine for the first graders.

    Later, I wrote a version of the Sierpinski triangle program in Pascal. It was something to do in my highschool Pascal class, which was interminably slow otherwise. It was my first introduction to fractals, and I was entranced.

  102. WJS says:

    If you think about it for a minute, there’s a very good reason that no points end up in the middle; to place point páµ¢ in the central void, where must point pᵢ₋₁ be? It would be outside the triangle, wouldn’t it? But where would point pᵢ₋₂ be for that? It would be further outside the triangle. Likewise, for point páµ¢ in one of the second voids, point pᵢ₋₁ would be in the central void.

    As for my first program, I honestly have no idea. I had the programmable calculator in school too, but I also had a “teach yourself C in 21 days” book as a kid, I never got very far with it, but I might have done more than just “Hello world” stuff. I don’t remember what I did with the calculator either.

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>

Leave a Reply

Your email address will not be published. Required fields are marked *