## Manufactoria: A Tile-based Programming Game

on May 24th, 2010 by Tom 5 Comments Random Stuff

What is a “tile-based programming game”? That’s a very good question. I never dreamt of such a thing until I played Manufactoria today. Be warned: if you’re not a programmer you will have great difficulty with this game.

A picture is worth a thousand lines of code, so I’ll show you a screenshot from the game. The following screenshot is an implementation of a bubble sort that operates on a queue of boolean variables.

A bubble sort implemented in Manufactoria

It’s an absolutely crazy idea for a game, isn’t it? Let me give you a quick overview of it.

## Why performSelector: Is More Dangerous Than I Thought

on May 14th, 2010 by Tom 7 Comments Cocoa

I fixed a rather nasty bug today in AspectObjectiveC. One particular unit test would crash with EXC_BAD_ACCESS every time. After learning far more about registers and ABIs than I ever wanted to know (thanks, Greg Parker), it dawned on me that performSelector: was corrupting memory. It was particularly hard to track down because the crash would happen a couple of lines after the call to performSelector:, when the corrupted memory was actually accessed.

I’ve never had a problem with performSelector: before, but this time I was using it a little differently. The return value of the selector was an NSRect.

Now for the gory explanation.