Human Resource Machine

Human Resource Machine

186 ratings
Hints, Tips, and Solutions
By SeltDude
Hints, tips, and solutions for all levels of Human Resource Machine. Includes solutions for both size and speed challenges, as well as alternate solutions for some of the trickier levels.
2
2
10
2
2
2
   
Award
Favorite
Favorited
Unfavorite
General Tips


General tips and things to remember:
  • Letter objects can be subtracted but not added.
  • The minimum value for integer objects is -999, and the maximum value is 999.
  • You must be holding something to add or subtract, and the result replaces the item being held.
  • BUMP commands do not require you to be holding anything.
  • Remember that OUTBOX gets rid of the item being held!
  • SUB ‘0’ means the number being held minus the number at tile ‘0’. The result replaces the number held. Follow with JUMPN and you have "if object is less than tile 0, jump here!"
  • Only COPYTO and BUMP commands can modify (write to) a tile.
  • There are only eleven commands in the whole language!


Size and Speed Challenges
Once the level is coded, look for ways to optimize your program to meet the size or speed challenges. Usually at least one of the goals can be achieved just by some simple optimizations (see tips below). In some cases, however, a completely different approach may be needed for a certain goal. The size goals are generally much easier to hit than the speed goals. Most of the 36 levels can hit both goals at once with one program. Levels that (as far as I can tell) do not have a single solution for both size and speed are:
  • Year 2: Busy Mail Room
  • Year 19: Countdown
  • Year 20: Multiplication Workshop
  • Year 28: Three Sort
  • Year 38: Digit Exploder
  • Year 40: Prime Factory

Coding for Size
  • Reuse code sections whenever possible (ie, using JUMPs).
  • Look for redundant COPYFROMs and COPYTOs.
  • Remember that the BUMP commands don't need an object to be picked up first, and end up with that same bumped object in your hands. (It's a free COPYFROM!)

Coding for Speed
  • Some early levels rely on loop unrolling, which is simply repeating the same command or command sequence rather than using JUMP to create a loop. Each JUMP is an extra command that adds to the step count. Many later levels can also be improved by loop unrolling, but there is usually a more elegant solution.
  • Sometimes the main outer loop of a program can be rearranged to save a JUMP command by having the INBOX in the middle of the loop, right after the final result is placed in the OUTBOX. This only saves a few steps, but can sometimes make the difference between meeting the goal or not. (Year 9 is a good example.)

The below sections have the solutions for each level, for both speed and size. Some have hints if a certain concept or way of thinking about the problem can be key to finding an optimized solution.

However, it is rewarding to solve these yourself, so I'd encourage readers to give each level (or "year") a good try before looking up solutions. The code provided can be simply cut and paste into the game, but even just looking at the code briefly for ideas and then going back to the game is more rewarding than just cutting and pasting. Either way, this guide is for you; use it how you wish!

Have fun!
Year 1: Mail Room
There is only one (sane) way to do this one! It meets both the size and speed challenges.

-- HUMAN RESOURCE MACHINE PROGRAM -- INBOX OUTBOX INBOX OUTBOX INBOX OUTBOX
Commands: 6/6 Steps: 6/6
Year 2: Busy Mail Room
Here the JUMP command is introduced. The size challenge should be no problem. For the speed challenge, try not to use the JUMP command as often (or even at all!)

For the size challenge:
-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX OUTBOX JUMP a
Commands: 3/3 Steps: 30/25


For the speed challenge, try handling two or more INBOX->OUTBOX moves in each iteration:
-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX OUTBOX INBOX OUTBOX JUMP a
Commands: 5/3 Steps: 25/25

Note that the JUMP instruction can be removed entirely by completely unrolling the loop. The boss man will complain if less than 12 inputs are handled. This results in a command count of 24, and a step count of 20. The inputs cycle through "BOOTSEQUENCE", "LOADPROGRAM", "INITIALIZE", and "AUTOEXEC". The longest of these is 12 letters ("BOOTSEQUENCE").

Year 3: Copy Floor
The floor tiles are our version of memory; in this case, read-only memory, or ROM. This level has the equivalent of a whopping 6 bytes of storage! (Not including our command list.)
Again, there is only one sane way to do this one, which meets both the size and speed challenges.

-- HUMAN RESOURCE MACHINE PROGRAM -- COPYFROM 4 -- 'B" OUTBOX COPYFROM 0 -- 'U' OUTBOX COPYFROM 3 -- 'G' OUTBOX
Commands: 6/6 Steps: 6/6
Year 4: Scrambler Handler
We can now write to memory (ie, floor tiles) with COPYTO! But there are only three memory locations. Luckily, one tile is all that is needed for some temporary storage. No special optimization should be needed to meet the size or speed challenges.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 INBOX OUTBOX COPYFROM 0 OUTBOX JUMP a
Commands: 7/7 Steps: 21/21

Note: For those going for the best possible speed, a lower step count can be accomplished by unrolling for all three inbox pairs, giving a score of 18 commands, 18 steps.
Year 6: Rainy Summer
This level introduces basic arithmetic using the ADD command. It requires that an item is already placed on the floor to be added with the value of the item in your worker's hands, with the result replacing that value.
-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 INBOX ADD 0 OUTBOX JUMP a
Commands: 6/6 Steps: 24/24
Note: A better speed can be accomplished by unrolling for all four inbox pairs, giving a score of 20 commands, 20 steps.
Year 7: Zero Exterminator
The idea of conditional execution is introduced with the JUMPZ command. The straightforward solution meets both size and speed goals (4 commands, 23 steps).

-- HUMAN RESOURCE MACHINE PROGRAM -- a: b: INBOX JUMPZ b OUTBOX JUMP a
Commands: 4/4 Steps: 23/23
Notes: A better "legitimate" speed can be accomplished by unrolling for all eight inbox items, giving a size of 24 commands, and taking an average of 19 steps.
Loop unrolling for all inbox items should be the best that can be done, given truly random inputs. It turns out, they are not really random -- there will never be more than two non-zero numbers in a row, the last value is always zero, etc. Given this, one can get away with coding only for a few specific data patterns get a better final speed score. The boss man will complain in some cases, but in the end a final score of 13 commands, 12 steps is allowed (at least that is the best I could do). This is building a program to pass for specific data, however, rather than solve the general problem at hand, and so these types of solutions will not be covered further.
Year 8: Tripler Room
Remember that multiplication just means adding the same number a specified number of times. Both temporary storage (COPYTO) and addition (ADD) are needed.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 ADD 0 ADD 0 OUTBOX JUMP a
Commands: 6/6 Steps: 24/24
Note: A better speed can be accomplished by unrolling for all four inbox pairs, giving a score of 20 commands, 20 steps.
Year 9: Zero Preservation Initiative
Here we just want to do the opposite of year 7 -- keep only the zeros. It should be pretty straightforward; however, the "straightforward" solution below meets the size goal but fails the speed goal (5 commands, 25 steps).

-- HUMAN RESOURCE MACHINE PROGRAM -- a: b: INBOX JUMPZ c JUMP b c: OUTBOX JUMP a
Commands: 5/5 Steps: 28/25



Loop unrolling can be done at the expense of a larger program size. Instead, in levels that use conditional jumps (like this one), we can often rearrange the main loop to decrease the overall number of JUMP commands executed. This is done by coding so that the output of the result (i.e., OUTBOX) is immediately followed by the next input (INBOX), allowing the JUMP normally at the end of the program to be skipped. When this is done, the first instruction will typically be a jump to the "middle" of the problem, where the input (INBOX) is.

Here is virtually the same solution from above, but with the main loop rearranged:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP a c: OUTBOX a: b: INBOX JUMPZ c JUMP b
Commands: 5/5 Steps: 25/25


It still has the same number of JUMP commands, but the first one is only executed once for the entire program run. For the zero case, the loop now runs with only three steps rather than four.

Note: Again, some loop unrolling can be used to find a slightly faster solution (18 commands, 21 steps).
Year 10: Octoplier Suite
The goal here is to multiply by 8. This could be done with a bunch of ADDs, but recall that 8 is, of course, 2*2*2. This means a sequence of doubling might just get to the desired result faster.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 ADD 0 COPYTO 0 ADD 0 COPYTO 0 ADD 0 OUTBOX JUMP a
Commands: 9/9 Steps: 36/36
Note: A better speed can be accomplished by unrolling for all four inbox pairs, giving a score of 32 commands, 32 steps.
Year 11: Sub Hallway
Just remember that both inputs need to be stored, since you need both a-b and b-a.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 INBOX COPYTO 1 SUB 0 OUTBOX COPYFROM 0 SUB 1 OUTBOX JUMP a
Commands: 10/10 Steps: 40/40
Note: Again, a slightly better speed can be accomplished by unrolling for all four inbox pairs, giving a size of 36 commands, and a speed of 36 steps.
Year 12: Tetracontiplier
a * 40 = (a * 8 * 5)

Multiply by eight as done in year 10, then multiply that as needed to get to x40 using ADDs.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 ADD 0 COPYTO 0 ADD 0 COPYTO 0 ADD 0 COPYTO 0 ADD 0 ADD 0 ADD 0 ADD 0 OUTBOX JUMP a
Commands: 14/14 Steps: 56/56
Note: A better speed can be accomplished by unrolling for all four inputs, giving a score of 52 commands, and 52 steps.
Year 13: Equalization Room
If a-b=0, then a=b.

If stuck on the speed challenge at 28 steps, try to rearrange the main loop such that INBOX follows OUTBOX, with no JUMP in between them (see level 9).
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP b a: COPYFROM 0 OUTBOX b: c: INBOX COPYTO 0 INBOX SUB 0 JUMPZ a JUMP c
Commands: 9/9 Steps: 27/27
Note: A slightly better speed can be accomplished by unrolling the input code, giving a size of 14 commands, and a speed of 25 steps.
Year 14: Maximization Room
If a < b, then a-b < 0.

After a subtraction, the original value held can be restored by ADDing the same value back.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 INBOX SUB 0 JUMPN c ADD 0 b: OUTBOX JUMP a c: COPYFROM 0 JUMP b
Commands: 10/10 Steps: 33/34






Rearrange the main loop to get a better step count:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP c a: COPYFROM 0 b: OUTBOX c: INBOX COPYTO 0 INBOX SUB 0 JUMPN a ADD 0 JUMP b
Commands: 10/10 Steps: 31/34
Year 16: Absolute Positivity
a - a - a = -a

One way to make a negative number positive is to subtract that same number from it twice. One can also subtract from 0, but since a zero value is not readily available for this task, this method would take more commands just to generate the zero.

With that in mind, this approach using SUB meets the size challenge.
-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX JUMPN c b: OUTBOX JUMP a c: COPYTO 0 SUB 0 SUB 0 JUMP b
Commands: 8/8 Steps: 39/36




Rearrange the loop to get a better step count and meet both goals:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP c a: COPYTO 0 SUB 0 SUB 0 b: OUTBOX c: INBOX JUMPN a JUMP b
Commands: 8/8 Steps: 34/36
Year 17: Exclusive Lounge
Three conditionals (JUMPNs) are needed to cover all four sign possibilities (++, +-, -+, and --).

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX JUMPN c INBOX JUMPN d b: -- +,+ or -,- COPYFROM 4 -- Pick up a 0 OUTBOX JUMP a c: INBOX JUMPN b d: -- +,- or -,+ COPYFROM 5 -- Pick up a 1 OUTBOX JUMP a
Commands: 12/12 Steps: 28/28
Note: Code comments are designated by '--'! The code can still be pasted directely into the game. No editing required!
Year 19: Countdown
Here the BUMP+ (BUMPUP) and BUMP- (BUMPDN) commands are introduced. The nice thing about them is that they do not require anything to be in hand before use.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 b: c: OUTBOX COPYFROM 0 JUMPN d JUMPZ a BUMPDN 0 JUMP c d: BUMPUP 0 JUMP b
Commands: 10/10 Steps: 111/82






For speed, rather than checking for a negative each time through, create two separate loops. One loop will count up (for the negative numbers), the other will count down:
-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX JUMPZ g COPYTO 0 JUMPN c b: OUTBOX BUMPDN 0 JUMPZ f JUMP b c: d: OUTBOX BUMPUP 0 JUMPZ e JUMP d e: f: g: OUTBOX JUMP a
Commands: 14/10 Steps: 82/82

















The main loop can also be rearranged to improve the step count a bit:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP d a: b: c: OUTBOX d: INBOX JUMPZ c COPYTO 0 JUMPN f e: OUTBOX BUMPDN 0 JUMPZ a JUMP e f: g: OUTBOX BUMPUP 0 JUMPZ b JUMP g
Commands: 14/10 Steps: 79/82
Year 20: Multiplication Workshop
The basic idea is to ADD the value from one input the number of times specified by the other input:

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 COPYFROM 9 -- Tile 9 is preloaded with 0 COPYTO 2 INBOX COPYTO 1 b: BUMPDN 1 JUMPN c COPYFROM 0 ADD 2 COPYTO 2 JUMP b c: COPYFROM 2 OUTBOX JUMP a
Commands: 15/15 Steps: 167/109
This has small enough code size but needs to be sped up. We can rearrange the main loop as has been done before, but that only gets the score to 15 commands, 163 steps. It is more effective to preload the result value to the first input value rather than zero, which saves one iteration of the loop for each multiplication. This can be done without increasing size, keeping the command count at 15 and improving step count to 135.



Finally, a couple other things can be done to improve the speed score (at the expense of size): First, handle zero as the first input value directly (17 commands, 111 steps), and second, always use the smaller number as the counter (since a x b is the same as b x a, and since we are adding, we will have fewer ADD operations if the smaller number is used as the counter). Here is the final program:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP e a: COPYTO 2 INBOX b: c: COPYFROM 2 d: OUTBOX e: INBOX JUMPZ a COPYTO 0 INBOX JUMPZ d COPYTO 1 SUB 0 JUMPN g COPYFROM 1 COPYTO 2 f: BUMPDN 0 JUMPZ c COPYFROM 2 ADD 1 COPYTO 2 JUMP f g: COPYFROM 0 COPYTO 2 h: BUMPDN 1 JUMPZ b COPYFROM 2 ADD 0 COPYTO 2 JUMP h
Commands: 29/15 Steps: 99/109






























A bit of size reduction can be done by removing duplicate COPYTO commands (lines 20 and 28) and adjusting the loop accordingly (Commands: 27/15 Steps 99/109)

If faster code is desired, a different tactic can also be used. We can unroll the countdown loop such that each copied iteration jumps to a different place. Thus we can use one of the multiplicands to control where the program jumps in order to ADD the specified number of times. We end up executing the same number of ADDs and BUMPDNs as in the previous version, but hardly any JUMPs. Note that this method assumes that we will only use single digit numbers as inputs. (The previous version does not make that assumption.)
-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 1 INBOX COPYTO 0 JUMPZ j BUMPDN 0 JUMPZ i BUMPDN 0 JUMPZ h BUMPDN 0 JUMPZ g BUMPDN 0 JUMPZ f BUMPDN 0 JUMPZ e BUMPDN 0 JUMPZ d BUMPDN 0 JUMPZ c BUMPDN 0 JUMPZ b BUMPDN 0 ADD 1 b: ADD 1 c: ADD 1 d: ADD 1 e: ADD 1 f: ADD 1 g: ADD 1 h: ADD 1 i: ADD 1 j: OUTBOX JUMP a
Commands: 33/15 Steps: 91/109




































Finally, rearrange the loop to save a few more cycles:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP k a: ADD 1 b: ADD 1 c: ADD 1 d: ADD 1 e: ADD 1 f: ADD 1 g: ADD 1 h: ADD 1 i: ADD 1 j: OUTBOX k: INBOX COPYTO 1 INBOX COPYTO 0 JUMPZ j BUMPDN 0 JUMPZ i BUMPDN 0 JUMPZ h BUMPDN 0 JUMPZ g BUMPDN 0 JUMPZ f BUMPDN 0 JUMPZ e BUMPDN 0 JUMPZ d BUMPDN 0 JUMPZ c BUMPDN 0 JUMPZ b BUMPDN 0 JUMP a
Commands: 33/15 Steps: 87/109
Year 21: Zero Terminated Sum
This one is pretty straightforward:

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX JUMPZ d b: COPYTO 0 INBOX JUMPZ c ADD 0 JUMP b c: COPYFROM 0 d: OUTBOX JUMP a
Commands: 10/10 Steps: 72/72







Rearrange the loop for a slight speed up:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP c a: COPYFROM 0 b: OUTBOX c: INBOX JUMPZ b d: COPYTO 0 INBOX JUMPZ a ADD 0 JUMP d
Commands: 10/10 Steps: 68/72
Note: A better speed can be accomplished by unrolling the core loop, giving a score of 30 commands, 60 steps.
Year 22: Fibonacci Visitor
A straightforward approach to this is to keep two tiles storing the last two values in the sequence, add, then update the tiles with both the new result and the previous result. Repeat as necessary until the output value is greater than the input tile. To meet the goals, output the first value before the loop starts.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 5 COPYFROM 9 -- '0' COPYTO 0 COPYTO 1 BUMPUP 0 OUTBOX b: COPYFROM 0 COPYTO 2 ADD 1 COPYTO 0 COPYFROM 5 SUB 0 JUMPN a COPYFROM 2 COPYTO 1 COPYFROM 0 OUTBOX JUMP b
Commands: 19/19 Steps: 156/156













A faster step count can be achieved by unrolling the loop a bit so we don't need to swap around the tiles each time to track the latest and next-to-latest values in the sequence. This method is much quicker, but no longer meets the size goal.
-- HUMAN RESOURCE MACHINE PROGRAM -- BUMPUP 9 -- preloaded with '0' a: b: COPYFROM 9 COPYTO 0 COPYTO 1 -- start with 1,1 INBOX COPYTO 5 -- ending value COPYFROM 0 OUTBOX COPYFROM 1 OUTBOX c: COPYFROM 1 ADD 0 COPYTO 0 COPYFROM 5 SUB 0 -- done yet? JUMPN a COPYFROM 0 OUTBOX COPYFROM 0 ADD 1 COPYTO 1 COPYFROM 5 SUB 1 -- done yet? JUMPN b COPYFROM 1 OUTBOX JUMP c
Commands: 27/19 Steps: 107/156
Year 23: The Littlest Number
As the numbers are read in, check whether each one is the smallest value seen so far. If so, store it as the new minimum. If not, just skip to the next input. The minimum value can be initialized with the first input.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 b: c: INBOX JUMPZ e SUB 0 JUMPN d JUMP b d: ADD 0 COPYTO 0 JUMP c e: COPYFROM 0 OUTBOX JUMP a
Commands: 13/13 Steps: 75/75











Rearranging the main loop gives a slight speed up:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP b a: COPYFROM 0 OUTBOX b: INBOX COPYTO 0 c: d: INBOX JUMPZ a SUB 0 JUMPN e JUMP c e: ADD 0 COPYTO 0 JUMP d
Commands: 13/13 Steps: 73/75
Year 24: Mod Module
The remainder of a division is essentially all that is needed, and this is fairly easy to do. Subtract off the divisor repeatedly until the number is negative. Add back the value and you have your remainder (modulo) value!

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 INBOX COPYTO 2 COPYFROM 0 b: SUB 2 JUMPN c JUMP b c: ADD 2 OUTBOX JUMP a
Commands: 11/12 Steps: 53/57







Rearranging the main loop:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP b a: ADD 2 OUTBOX b: INBOX COPYTO 0 INBOX COPYTO 2 COPYFROM 0 c: SUB 2 JUMPN a JUMP c
Commands: 11/12 Steps: 50/57
Year 25: Cumulative Countdown
This one is straightforward. Use BUMP- and ADD in a loop.
-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX JUMPZ d COPYTO 1 COPYTO 0 b: BUMPDN 0 JUMPZ c ADD 1 COPYTO 1 JUMP b c: COPYFROM 1 d: OUTBOX JUMP a
Commands: 12/12 Steps: 82/82










Rearranging the loop, and removing a redundant COPYTO improves both size and speed:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP c a: COPYFROM 1 b: OUTBOX c: INBOX JUMPZ b COPYTO 0 d: COPYTO 1 BUMPDN 0 JUMPZ a ADD 1 JUMP d
Commands: 11/12 Steps: 79/82
Year 26: Small Divide
This one is similar to year 24, but the number of subtracts needs to be counted.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: COPYFROM 9 -- '0' COPYTO 4 INBOX COPYTO 0 INBOX COPYTO 2 b: COPYFROM 0 SUB 2 JUMPN c COPYTO 0 BUMPUP 4 JUMP b c: COPYFROM 4 OUTBOX JUMP a
Size: 15/15 Speed: 76/76











Rearranging the loop to save a few steps:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP b a: COPYFROM 4 OUTBOX b: COPYFROM 9 -- '0' COPYTO 4 INBOX COPYTO 0 INBOX COPYTO 2 c: COPYFROM 0 SUB 2 JUMPN a COPYTO 0 BUMPUP 4 JUMP c
Size: 15/15 Speed: 73/76
Year 28: Three Sort
This one is tedious. Coding for size, perform a sort by swapping the values when they are not in order, and repeat.
-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 INBOX COPYTO 2 INBOX COPYTO 1 SUB 2 JUMPN c b: COPYFROM 1 COPYTO 3 COPYFROM 2 COPYTO 1 COPYFROM 3 COPYTO 2 c: COPYFROM 0 SUB 1 JUMPN d COPYFROM 1 COPYTO 3 COPYFROM 0 COPYTO 1 COPYFROM 3 COPYTO 0 d: COPYFROM 2 SUB 1 JUMPN b COPYFROM 0 OUTBOX COPYFROM 1 OUTBOX COPYFROM 2 OUTBOX JUMP a
Commands: 33/34 Steps: 129/78






























To code for speed, one way is to use a bunch of conditional logic to figure out which of the six possible input orders we have, then output for that order.
-- HUMAN RESOURCE MACHINE PROGRAM -- a: b: c: d: e: f: INBOX COPYTO 0 INBOX COPYTO 1 INBOX COPYTO 2 SUB 1 JUMPN h COPYFROM 1 SUB 0 JUMPN g COPYFROM 0 OUTBOX COPYFROM 1 OUTBOX COPYFROM 2 OUTBOX JUMP a g: COPYFROM 2 SUB 0 JUMPN k COPYFROM 1 OUTBOX COPYFROM 0 OUTBOX COPYFROM 2 OUTBOX JUMP b COMMENT 0 h: COPYFROM 2 SUB 0 JUMPN i COPYFROM 0 OUTBOX COPYFROM 2 OUTBOX COPYFROM 1 OUTBOX JUMP c i: COPYFROM 0 SUB 1 JUMPN j COMMENT 1 COPYFROM 2 OUTBOX COPYFROM 1 OUTBOX COPYFROM 0 OUTBOX JUMP e j: COPYFROM 2 OUTBOX COPYFROM 0 OUTBOX COPYFROM 1 OUTBOX JUMP d k: COPYFROM 1 OUTBOX COPYFROM 2 OUTBOX COPYFROM 0 OUTBOX JUMP f
Commands: 62/34 Steps: 78/78
Year 29: Storage Floor
This task introduces the idea of indirect addressing, which allows us to use items as pointers. Year 28 (Three Sort) would have been easier with pointers!

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 10 COPYFROM [10] OUTBOX JUMP a
Commands: 5/5 Steps: 25/25
Year 30: String Storage Floor
This builds on the last level, adding the idea of incrementing a pointer to point to the next location in memory (or on the floor, as is the case here!).

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 24 b: COPYFROM [24] JUMPZ a OUTBOX BUMPUP 24 JUMP b
Commands: 7/7 Steps: 203/203
Year 31: String Reverse
Storing the strings starting at tile 1 rather than tile 0 helps with detecting the string terminator and handling null strings.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: BUMPUP 14 -- '0' to '1' b: INBOX JUMPZ c COPYTO [14] BUMPUP 14 JUMP b c: d: BUMPDN 14 JUMPZ a COPYFROM [14] OUTBOX JUMP d
Size: 11/11 Speed: 121/122
Note: Your boss will accept a program that fails for a null string (since it is not a part of the test data set). Such a program could reduce the step count to 118 (or better?), but would be incorrect!
Year 32: Inventory Report
Use a tile as an index pointer to the "inventory", and another tile as a counter for the requested item. Remember, letters can be subtracted to test for equality.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: COPYFROM 14 -- '0' COPYTO 16 COPYTO 17 INBOX COPYTO 15 JUMP d b: BUMPUP 17 c: BUMPUP 16 d: COPYFROM [16] JUMPZ e SUB 15 JUMPZ b JUMP c e: COPYFROM 17 OUTBOX JUMP a
Commands: 16/16 Steps: 383/393















Rearranging the main loop again saves some steps:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP b a: COPYFROM 17 OUTBOX b: COPYFROM 14 -- '0' COPYTO 16 COPYTO 17 INBOX COPYTO 15 JUMP e c: BUMPUP 17 d: BUMPUP 16 e: COPYFROM [16] JUMPZ a SUB 15 JUMPZ c JUMP d
Commands: 16/16 Steps: 380/393
Year 34: Vowel Incinerator
This is similar to the last level. Just interate through the vowels, checking if they match the input letter.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: b: COPYFROM 5 -- '0' COPYTO 7 INBOX COPYTO 6 c: COPYFROM [7] JUMPZ d SUB 6 JUMPZ a BUMPUP 7 JUMP c d: COPYFROM 6 OUTBOX JUMP b
Commands: 13/13 Steps: 323/323











We can also rearrange the main loop on this one for a small improvement:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP c a: COPYFROM 6 OUTBOX b: c: COPYFROM 5 -- '0' COPYTO 7 INBOX COPYTO 6 d: COPYFROM [7] JUMPZ a SUB 6 JUMPZ b BUMPUP 7 JUMP d
Commands: 13/13 Steps: 318/323
Year 35: Duplicate Removal
All items must be checked for duplicates and then stored (if no duplicate found) as they are read from the inbox. For meeting the speed challenge goal, the first item cannot have a duplicate, so it can be directly copied without checking.

-- HUMAN RESOURCE MACHINE PROGRAM -- INBOX COPYTO 0 a: OUTBOX b: INBOX COPYTO 12 COPYFROM 14 COPYTO 13 c: COPYFROM [13] SUB 12 JUMPZ b BUMPDN 13 JUMPN d JUMP c d: BUMPUP 14 COPYFROM 12 COPYTO [14] JUMP a
Commands: 17/17 Steps: 159/167
Year 36: Alphabetizer
Copy the first word into memory, then compare to the second word one letter at a time as it is read from the inbox. Once there is a difference, just finish writing out the correct word -- either from memory or from the inbox.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: b: c: d: COPYFROM 23 COPYTO 22 e: -- read in first word INBOX COPYTO [22] JUMPZ f BUMPUP 22 JUMP e f: -- read in second word COPYFROM 23 COPYTO 22 INBOX JUMPZ b g: -- compare letters COPYTO 21 SUB [22] JUMPZ i -- if equal, keep going JUMPN j -- 2nd word comes first h: -- output first word COPYFROM [22] JUMPZ l OUTBOX BUMPUP 22 JUMP h i: -- letters same. output, get next COPYFROM [22] OUTBOX BUMPUP 22 COPYFROM [22] JUMPZ m INBOX JUMPZ a JUMP g j: -- write out rest of 2nd word COPYFROM 21 k: OUTBOX INBOX JUMPZ d JUMP k l: -- throw away rest of first word m: n: INBOX JUMPZ c JUMP n
Commands: 36/39 Steps: 75/109

Here's the same program, but with (slightly) more meaningful labels. Yes, it can still be pasted directly!
-- HUMAN RESOURCE MACHINE PROGRAM -- begin: COPYFROM 23 COPYTO 22 readword1: INBOX COPYTO [22] JUMPZ readword2 BUMPUP 22 JUMP readword1 readword2: COPYFROM 23 COPYTO 22 INBOX JUMPZ begin checkletters: COPYTO 21 SUB [22] JUMPZ nextletter JUMPN writeword2 writeword1: COPYFROM [22] JUMPZ tossword2 OUTBOX BUMPUP 22 JUMP writeword1 nextletter: COPYFROM [22] OUTBOX BUMPUP 22 COPYFROM [22] JUMPZ tossword2 INBOX JUMPZ begin JUMP checkletters writeword2: COPYFROM 21 loopword2: OUTBOX INBOX JUMPZ begin JUMP loopword2 tossword2: INBOX JUMPZ begin JUMP tossword2
Year 37: Scavenger Chain
It's a linked list! Just output the first item, then bump and use that next item as a pointer to the next list object. Repeat until a negative value is encountered.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX b: COPYTO 5 COPYFROM [5] OUTBOX BUMPUP 5 COPYFROM [5] JUMPN a JUMP b
Commands: 8/8 Steps: 63/63
Year 38: Digit Exploder
The most straight-forward way is to divide by 100, then divide the remainder by 10, then use the remainder for the ones value. However, watch out for leading zeros -- they should not be output and tracking that can be tricky.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 1 COPYFROM 9 COPYTO 3 COPYTO 4 b: COPYFROM 1 SUB 11 JUMPN c COPYTO 1 BUMPUP 3 JUMP b c: COPYFROM 3 JUMPZ d OUTBOX d: e: COPYFROM 1 SUB 10 JUMPN f COPYTO 1 BUMPUP 4 JUMP e f: COPYFROM 4 JUMPZ i g: OUTBOX h: COPYFROM 1 OUTBOX JUMP a i: COPYFROM 3 JUMPZ h COPYFROM 4 JUMP g
Commands: 30/30 Steps: 214/165































For meeting the speed challenge, unrolling with unique jumps for each value can be used. It is tedious but it works.
-- HUMAN RESOURCE MACHINE PROGRAM -- a: COPYFROM 9 COPYTO 3 COPYTO 4 INBOX COPYTO 1 SUB 11 JUMPN j COPYTO 1 SUB 11 JUMPN i COPYTO 1 SUB 11 JUMPN h COPYTO 1 SUB 11 JUMPN g COPYTO 1 SUB 11 JUMPN f COPYTO 1 SUB 11 JUMPN e COPYTO 1 SUB 11 JUMPN d COPYTO 1 SUB 11 JUMPN c COPYTO 1 SUB 11 JUMPN b COPYTO 1 SUB 11 BUMPUP 3 b: BUMPUP 3 c: BUMPUP 3 d: BUMPUP 3 e: BUMPUP 3 f: BUMPUP 3 g: BUMPUP 3 h: BUMPUP 3 i: BUMPUP 3 OUTBOX j: COPYFROM 1 SUB 10 JUMPN u COPYTO 1 SUB 10 JUMPN r COPYTO 1 SUB 10 JUMPN q COPYTO 1 SUB 10 JUMPN p COPYTO 1 SUB 10 JUMPN o COPYTO 1 SUB 10 JUMPN n COPYTO 1 SUB 10 JUMPN m COPYTO 1 SUB 10 JUMPN l COPYTO 1 SUB 10 JUMPN k COPYTO 1 SUB 10 BUMPUP 4 k: BUMPUP 4 l: BUMPUP 4 m: BUMPUP 4 n: BUMPUP 4 o: BUMPUP 4 p: BUMPUP 4 q: BUMPUP 4 r: BUMPUP 4 s: OUTBOX t: COPYFROM 1 OUTBOX JUMP a u: COPYFROM 3 JUMPZ t COPYFROM 4 JUMP s
Commands: 89/30 Steps: 151/165
Year 39: Re-Coordinator
The basic idea here is to divide and use both the result and the remainder to get the proper coordinates. Reviewing years 24 and 26 should help.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: COPYFROM 14 COPYTO 0 INBOX b: SUB 15 JUMPN c COPYTO 1 BUMPUP 0 COPYFROM 1 JUMP b c: ADD 15 OUTBOX COPYFROM 0 OUTBOX JUMP a
Commands: 14/14 Steps: 76/76










We can also rearrange the main loop on this one for a small improvement:
-- HUMAN RESOURCE MACHINE PROGRAM -- JUMP b a: ADD 15 OUTBOX COPYFROM 0 OUTBOX b: COPYFROM 14 COPYTO 0 INBOX c: SUB 15 JUMPN a COPYTO 1 BUMPUP 0 COPYFROM 1 JUMP c
Commands: 14/14 Steps: 73/76
Year 40: Prime Factory
The word 'prime' makes this sound harder than it really is. One method which produces a decent code size is to simply test all numbers (regardless of whether they are prime) from 2 to the input value (ie, check if they are factors of the number). It will have a fairly long execution time, however:
-- HUMAN RESOURCE MACHINE PROGRAM -- COPYFROM 24 COPYTO 23 BUMPUP 23 a: INBOX COPYTO 0 COPYFROM 23 COPYTO 3 b: BUMPUP 3 COPYFROM 24 COPYTO 2 COPYFROM 0 c: d: SUB 3 COPYTO 1 JUMPN b JUMPZ e BUMPUP 2 COPYFROM 1 JUMP d e: COPYFROM 3 OUTBOX COPYFROM 2 JUMPZ a COPYTO 0 COPYFROM 24 COPYTO 2 BUMPUP 0 JUMP c
Commands: 27/28 Steps: 426/399
























Speed can be improved if we only check for prime factors (as the program name implied), but this is at the expense of code size, since they need to be specified in the code:
-- HUMAN RESOURCE MACHINE PROGRAM -- COPYFROM 24 COPYTO 1 BUMPUP 1 BUMPUP 1 COPYTO 2 BUMPUP 2 ADD 1 COPYTO 3 ADD 1 COPYTO 4 ADD 1 ADD 1 COPYTO 5 ADD 1 COPYTO 6 ADD 1 ADD 1 COPYTO 7 ADD 1 COPYTO 8 a: INBOX COPYTO 15 COPYFROM 24 COPYTO 18 b: BUMPUP 18 COPYFROM 24 COPYTO 17 COPYFROM 15 c: d: SUB [18] COPYTO 16 JUMPN b JUMPZ e BUMPUP 17 COPYFROM 16 JUMP d e: COPYFROM [18] OUTBOX COPYFROM 17 JUMPZ a COPYTO 15 COPYFROM 24 COPYTO 17 BUMPUP 15 JUMP c
Commands: 44/28 Steps: 338/399
Year 41: Sorting Floor
One solution to the problem is a selection sort. This can be written pretty easily within the desired size, but speed is a problem. (My implementation was 27 commands, 801 steps.)

A better solution is to think of the problem in a different way: simply find the minimum value, output it, and repeat. So rather than sorting everything in place, we iterate through the items, find the smallest value, output it, and then replace the item just output with last value on the list. Thus the list grows shorter with each iteration. This is much simpler, and much faster to execute as well.

-- HUMAN RESOURCE MACHINE PROGRAM -- a: b: BUMPUP 24 INBOX JUMPZ d COPYTO [24] JUMP b c: COPYFROM [21] OUTBOX COPYFROM [24] COPYTO [21] d: BUMPDN 24 JUMPZ a COPYTO 21 COPYTO 22 e: f: BUMPDN 22 JUMPZ c COPYFROM [21] SUB [22] JUMPN f COPYFROM 22 COPYTO 21 JUMP e
Commands: 21/34 Steps: 648/714
Achievements
Career Milestone 1
Reach level 5.

Career Milestone 2
Reach level 15.

Career Milestone 3
Reach level 18.

Career Milestone 4
Reach level 27.

Career Milestone 5
Reach level 33.

Career Milestone 6
Reach the last level.

Green Optimization Award
Optimize all levels on the green path for size and speed.

Blue Optimization Award
Optimize all levels on the blue path for size and speed.

Orange Optimization Award
Optimize all levels on the orange path for size and speed.

Social Engineer
Ask all bosses to tell you more.

Queen of Inefficiency
Get this in early levels by just padding your solution with jumps to the next line.

King of Verbosity
The speed solution for year 2 (in this guide) triggers this one. Or just throw in a bunch of jumps as above.

Glorious Failure: Overflow
This can be done easily in any level once you have the ADD or SUB commands. ADD numbers in an infinite loop. Achievement triggers when it attempts to exceed the 999 limit (or, alternatively, subtract until it tries to go below -999).

Glorious Failure: Out of Bounds
This one needs indirect accessing, so it cannot be achieved until floor 29 or higher is reached. Use indirect access on a tile that is negative or larger than the floor size.

Glorious Failure: Solution Not Robust
This is for a solution that fails for certain inputs. Get this on purpose by trying to make a program that handles the inputs given specifically. The easiest way to get it is in year 2; unroll the loop for the precise number of items in the inbox.

Excellent Instruction Follower
Beat all levels of the game.
27 Comments
Cezary Pazura Mar 11, 2023 @ 5:24am 
Great guide ;]
S.T.A.R.S Leon S. K. Jan 12, 2023 @ 5:25am 
Thanks for Guide. 38 Nr. 2 didnt work for me (got 5 instead of 4 always)

Rest all work fine. Merci Grazie for your Work

On Left Side Solutions Numbers 1. 2. 3. and a: (41.)

But awesome Work
xRaiden Jan 11, 2023 @ 4:43am 
Great Guide, Thank you! :kingofthejungle::horns:
nuzunuzu Jan 4, 2023 @ 5:40am 
The inputs they check against in year 40 are actually quite bad. You can just check for "2" and "3" then send the remaining number. I got the speed optimization without even trying as it is quite harder for the program to take that long when only checking for two primes.
Swiss Dec 28, 2022 @ 10:31pm 
I had to strip the helpful labels to make it fit. DM me if you want the full program with labels.
Swiss Dec 28, 2022 @ 10:29pm 
I found a solution to pass both size and speed optimizations for Year 40:

-- HUMAN RESOURCE MACHINE PROGRAM --

COMMENT 0
a:
COPYFROM 24
COPYTO 20
COPYTO 21
BUMPDN 21
INBOX
COPYTO 15
COMMENT 1
b:
BUMPUP 20
c:
BUMPUP 20
d:
COPYFROM 24
COPYTO 18
COPYFROM 15
e:
SUB 20
JUMPZ f
JUMPN g
COPYTO 19
BUMPUP 18
COPYFROM 19
JUMP e
f:
COPYFROM 20
OUTBOX
COPYFROM 18
JUMPZ a
BUMPUP 18
COPYTO 15
JUMP d
g:
BUMPUP 21
JUMPZ c
JUMP b
COMMENT 2
Shirako-TEKU May 12, 2021 @ 10:22am 
Year 30 Output :
THE TARGET XXX IS AWAKE X TAKE THIS X

Year 31 Output :
ONE BOY GIRL

Year 36 Output :
UNDER

4er(n) Apr 17, 2021 @ 11:20am 
Thanks for examples of solution.
Rempber! You can improve some of the solution, although it is not required ;)

For Example:
Year 41: Sorting Floor - 20 commands instead of 21.
Year 40: Prime Factory - 23 commands instead of 27 & 236 steps instead of 338.
Year 36: Alphabetizer - 30/67 commands/steps instead of 36/75.
Year 35: Duplicate Removal - 156 steps instead of 159
Year 31: String Reverse - 10 commands instead of 11.
If anyone is interested, I can write these solutions.
Cubicle.Dexter Feb 23, 2021 @ 10:44pm 
Thank you for this guide. I bring it up for inspiration when I'm stuck, so I thought I'd return the favor. Year 22 can meet both goals with this code.

-- HUMAN RESOURCE MACHINE PROGRAM --

a:
INBOX
COPYTO 7
BUMPUP 7
COPYFROM 9
COPYTO 0
COPYTO 1
BUMPUP 1
b:
OUTBOX
COPYFROM 0
ADD 1
COPYTO 2
SUB 7
JUMPN c
JUMP a
c:
COPYFROM 1
COPYTO 0
COPYFROM 2
COPYTO 1
JUMP b

.:HighKnee:. Feb 14, 2021 @ 2:03am 
'Year 23: The Littlest Number' can be further optimized (12 commands/71 steps)

-- HUMAN RESOURCE MACHINE PROGRAM --

JUMP b
a:
COPYFROM 0
OUTBOX
b:
INBOX
JUMP d
c:
ADD 0
d:
COPYTO 0
e:
INBOX
JUMPZ a
SUB 0
JUMPN c
JUMP e