Human Resource Machine: Basic Programing and Optimization


Welcome to the Human Resource Machine, a workplace dedicated to transforming inputs into productive outputs.  HRM is a puzzle game that doubles as an introduction to programing. The player guides a office worker through thirty-seven levels of picking up blocks (numbers) from an inbox and depositing the correct result (still numbers) into the outbox. The concept is simple, each level is in the same room, and all the puzzles are completely independent of the others (though obviously they progress in difficulty).

The first room is easy. The boss wants you to move three numbered blocks from the inbox to the outbox. The clipboard on which you write the program has only two commands to choose from; →inbox, which causes the worker to pick up the next number block in the inbox, and outbox→, which causes the worker to place whatever block he is holding into the outbox. There are only three blocks in the inbox, so the program can look like this:

inbox
outbox→
inbox
outbox→
inbox
outbox→

Upon completion the game shows the victory screen. Completing a puzzle allows the player to advance to the next one, but the game also includes two optimization challenges. The first has you complete the puzzle with a maximum number of commands.  The solution for the first puzzle contains six commands. If I added another Inbox and Outbox combination (and I'm done with the arrows) then it would contain eight commands.   Commands measures the number of commands on the clipboard.

The second challenge sets a maximum amount steps the player can use to finish the puzzle. For the first puzzle, it was also six. But if I added an inbox/outbox combo the number of steps would still be six, not eight, because the extra commands would not have been needed to transport the three blocks to the outbox.  Steps measures the total number of times the worker accesses each command.



As the player advances, the optimization challenges won't always be so easy. Helpfully, if the player is unable to complete the optimization challenges, the game saves the player's solutions so they can return to them later. It also points out, later on a solution to a puzzle that minimizes the number of commands, is unlikely to also minimize the amount of steps.

Let's a take a look at puzzle nine to confirm (Zero Preservation Initiative). In this puzzle the player needs to send only the zeros from the inbox to the outbox.  There are five boxes.  By this time a number of additional commands have been added: copyto, copyfrom, add, jump, and jump if zero. Copyto allows the player to copy a block they are holding onto a space on the floor. Copyfrom, allows them to replace whatever they are holding with whatever is on the floor. Add, surprisingly, adds a chosen number on the floor to whatever is currently being held. These are all important commands, but the jump commands are the most critical of all. When the worker reaches a jump command they move to a predesignated point in the program.



To move only zeros to the outbox, I designed a program that succeeded on the number of commands (max 6), but failed the amount of steps (max 25).  

a
b
Inbox
Jump (if zero) c
Jump a
c
Outbox
Jump b

The program reads like this. 1) Pick up from inbox. 2) Jump to C if the number is zero. 3) Outbox the block. 4) Then jump to the B, which is the beginning. 5) If the block wasn't zero jump to A (which is also at the beginning). 6) Drop the box and continue from step 1.

This program works.  It has five commands, but it averages 27 steps with the five blocks, instead of the 25 required for the optimization challenge.

Here's another program. I didn't write it, but found it on the Steam forum.

Jump b
a
Outbox
b
c
Inbox
Jump (if zero) a
Jump C

It is better (more efficient) than mine because it uses five commands, but completes the five blocks in 25 steps.

It says, 1) Jump to B. 2) Pick up from inbox. 3) Jump to A if block is zero. 4) Place block in Outbox. 5) Return to 1. 6) If the block in step 3 wasn't zero then Jump to C. 7) Drop block and continue from step 2.

After looking at other programs it becomes obvious that the well written ones (not mine), often start with Jump commands, but mine end with them. Or maybe that is just all my limited understanding can pick out.



Level nine, as explained above, wasn't difficult. Finding an optimization solution that worked for both challenges probably wasn't either, though I didn't succeed. And in fact, all the way through level 11, I completed both optimization challenges just by completing the puzzle. I didn't even have to think about the them. Over the next few missions, completing the puzzle wasn't hard, but I didn't finish either of optimization challenges. But now, about two thirds of the way on the main path (and there are occasional side missions), I'm finding it difficult to even complete puzzle.

Part of this is because the game, at first, offers helpful instructions, almost like teaching, but this ends at about level 11. From there, only minimal instruction is provided. Having read comments about the game online, many players have tried to search for programming hints to assist them, while anyone that actually is a programmer and picks up the game finds it incredibly easy (which makes sense).

Next Monday, I'll take a further look at the more complex issues of Human Resource Machine, and hopefully I'll have finished the main game, even if I'm unable to complete all the bonus levels and the challenges.

Comments