Human Resource Machine, from the Tomorrow Corporation, is a puzzle game that basically boils down to assembly-language programming. It has a very charming graphical style and plenty of entertaining sideshows, hiding the rather dry core game in a way that really works! It is really great fun and challenging – even for myself who has a reasonable amount of experience coding at this low level. It feels a bit like coding in the 1980s, except that all instructions take the same amount of time in the game.
The core of the game is a series of programming puzzles where you build assembly language programs using drag-and-drop into a panel. Here is one of the early problems:
Note that the game had a completely delightful Swedish translation which it decided to use for my installation (guess it has something to do with the locale of this particular machine). There is a lot of “dialogue” from the manager in the corner that is often rather funny!
The limited set of commands available and the way that you only have a single accumulator register (the worker guy) forces you to learn and use classic techniques like using SUB (subtract) commands to implement comparisons. It is super-annoying that there are only “Jump if zero” and “Jump if negative” available as jumps. Quite often, I would have liked to have their inverses too… but that is part of the point.
Each level has a few different input sets, and they are designed to catch the unwary programmer. On Steam, the game even has a set of achievements for particular types of bugs. Here are ones I have unlocked so far. “Glorious Failure”!
Speed and Size Challenges
After a while, you get puzzles where you need to meet code size and performance goals. A simple first solution often is a bit bigger and a bit more time consuming than the optimal. Usually, it is not too hard to find a solution that matches the provided goals. Sometimes, speed and size have to be optimized in separate solutions. Like in this case, where it seems I must have dead code seeing that I have more code (the top, “Storleksutmaning”) than steps executed (the bottom, “hastighetsutmaning”):
However, the goals are not necessarily the minimum possible! In the case shown below, I managed to beat both size (the top, “Storleksutmaning”), and speed (the bottom, “hastighetsutmaning”) for a Fibonacci computation.
The kind of coding needed to meet the optimization goals is familiar to anyone who has done a bit of manual optimization or compiler work. Quite often I find myself pulling instructions across jumps, or trying somehow to reduce a mess of jumps to a smaller set. Or figuring out how to achieve a computation using a minimum number of memory accesses (copying to and from the table in the middle of screen). Loop unrolling comes in quite a few cases.
There are also cases where you just should check for simple base cases – like checking if a value involved in multiplication is zero then going straight to output zero. It looks like the speed challenges do expect you to do that in several cases – but the whole count of operations is not entirely clear to me. Maybe the game checks over all the available input sets for a level?
One delightful and annoying feature of the game is how you put labels on things and comments in the code. You draw by hand. No text input, just freehand drawing. The results look rather childish, at least when I am drawing on free hand with a mouse.
Go to Text to Code
You can copy and paste programs between levels, as well to an external text editor! The text editor comes in handy in cases where you want to copy segments of code for said really aggressive loop unrolling… it is a lot easier to handle text like:
Compared to its graphical representation, with a silly number of jump arc on the right.
This is a just brilliant game. A nice puzzler, and one that you can play along with kids to teach them a bit of low-level programming! You do need a few years of school to understand some of the problems, but given that it has turned into a nice family activity to sit around and see how to solve a particular problem.
I almost wonder if this could not be a good little tool for introductory computer architecture. Just a little bit to give a sense for how to solve problems in computing given very limited instructions and resources.
I have not completed the game yet, there is a story going on in the intermissions that will be interesting to see complete.
Recommended, very highly recommended. Thanks to IEEE Spectrum for pointing me at the game originally!