The earliest memory I have of ‘programming’ is in the early/mid 90s when my father brought home a computer from work. We could play games on it … so of course I took the spreadsheet program he used (LOTUS 123, did I date myself with that?) and tried to modify it to print out a helpful message for him. It … halfway worked? At least I could undo it so he could get back to work…

After that, I picked up programming for real in QBASIC (I still have a few of those programs lying around), got my own (junky) Linux desktop from my cousin, tried to learn VBasic (without a Windows machine), and eventually made it to high school… In college, I studied computer science and mathematics, mostly programming in Java/.NET, although with a bit of everything in the mix. A few of my oldest programming posts on this blog are from that time.

After that, on to grad school! Originally, I was going to study computational linguistics, but that fell through. Then programming languages (the school’s specialty). And finally I ended up studying censorship and computer security. That’s about where I am today!

But really, I still have a habit of doing a little bit of everything. Whatever seems interesting at the time!

Procedural Invaders

Today’s post comes from a long line of ‘inspired by posts’ all pretty much leading back (so far as I can tell) to this post by j.tarbell: invader.procedural from 2003.

The basic idea is that we want to generate ‘invaders’ in the style of space invaders. Except we don’t want 10 or 20, we want tens of thousands. So how do we do it? Well, take a look at this:

read more...


Chess Puzzles: N Queens

After two weeks, it seems only right that we actually get around to a real chess puzzle. First on the list: Eight queens puzzle.

Specifically, how do you place n queens on an n by n chess board such that no pair of queens can attack one another?

read more...


Chess Puzzles 2: Board?

Now that we’ve got Ludum Dare out of the way, back to chess! Last time, we defined all of the pieces, which is all well and good, but what we really need is a board. More specifically, we want something that can:

  • Represent an 8x8 chess board, storing the location of pieces (including the owner of each)
  • Add logic for collisions, so that when moving a piece, you cannot move through others or capture allies1
  • Add rendering code to display the current chess board (must be flexible enough to handle arbitrary glyphs for fairy chess pieces)

I think that’s about enough for the moment. Let’s do it!

read more...


Ludum Dare 30: Demo mode

Quick update this morning: I managed to get a ‘demo mode’ working. Now when you first start the game, the boxes will be whizzing around in the background giving you an idea of what you’re about to get yourself into!

read more...


Ludum Dare 30: Programmer art and simple AI

A few hours later and we’ve already finished (or at least made good progress on) two of the goals that I was hoping for:

  • AI players; at the very least one that moves randomly, but optimally several different kinds
  • Pending the previous, a selector on the options screen that can turn each player either off, on, or to any of the current AIs
  • Stylings around the page; probably some sort of thick border that bleeds a little in and out, looking different per player

read more...


Ludum Dare 30: 24 hours

Here we are, 24 hours into the competition.

A lot of the last few hours has been spent doing a fair amount of restructing. Before, I had a single ’thread’1 for each of the tiles, along with another thread listening for user input. Unfortunately though, that lead to all sorts of race conditions. Specifically, whenever two tiles overlapped, it was often the case that one was doing the falling step (which copies from one internal buffer to another) while the other was in the swap step (which copies from tile to another). Then after the first finished, it would copy the second buffer over… overwriting anything that had been swapped.

Oops.

read more...