Human Resource Machine

### Human Resource Machine

134 ratings
Solution hints, no spoilers
By kermit
Gives hints for basic solutions, size challenges and speed challenges without giving you the acutal code. If you're looking to just copy and paste a complete solution, you'll find them in this repository[github.com].

Rate
Year 2 - Busy Mail Room
Speed challenge: 25
You've probably solved the puzzle by using a sequence of input, output, jump to start. The jump instruction does not do any input/output work, but is useful to keep the process repeating.

The jump adds 1 instruction per item that is 'extra' to the actual work required. What if you transported two items before jumping back to the beginning? The extra cost of the jump instruction would be reduced to 1 per two items.

Knowing that this puzzle's input is never longer than 12 items, can you go all the way and pass even below the challenge mark of 25?

The technique used here is called loop unrolling. The goal is to try and avoid the cost of loop iteration instructions at runtime at the cost of verbatim repetitions of loop contents.
Year 9 - Zero Preservation Initiative
Speed Challenge
Unrolling the loop helps here. Just repeat verbatim instead of jumping to beginning.
Year 10 - Octoplier Suite
Size Challenge: 9
If you're struggling to get down to 9 instructions total, the trick is to use the hint given in the game. Can you multiply by 8 using 3 add instructions only?

Obviously, you can't just add the input 3 times. You need to generate intermediate results and add them. Doubling an item 3 times is the same as multiplying it by 8 you know.

a × 2 × 2 × 2 = a × 8
Year 12 - Tetracontiplier
Size Challenge: 14
In this particular challenge it is worth remembering that in the Octoplier level, you found a quick way to create a x 8. Adding this value 4 times onto itself gives you a x 8 x 5 = a x 40.
Implementing the idea efficiently also solves the speed challenge.
Year 14 - Maximization Room
Size Challenge
Realizing that a - b + b = a might help save instructions here.
Year 16 - Absolute Positivity
Subtracting a number from itself twice always generates the original but with the sign inverted. The first subtraction lands you at 0, the second generates the opposite of the original.
x - x - x = (x - x) - x = 0 - x = -x

Year 19 - Countdown
Speed Challenge
Having three separate branches for inputs of 0, positive, negative is good enough to pass.

Year 20 - Multiplication Workshop
Speed Challenge
Early test for multiplication by 0 and remembering that a x b = b x a may minimize the number of loop iterations.
Year 22 - Fibonacci Visitor
Size Challenge
Initializing with 0,1 instead of 1,1 might help reducing instructions, assuming you follow a "add current with predecessor" and "swap predecessor with current" approach.

Speed Challenge
Having two sections of code alternate on where they put the next sequence number cuts down instructions needed for swaps.
Year 28 - Three Sort
Size Challenge
Arrange your a, b, c in a row, swap if necessary, output the row in order.

Speed Challenge
Handle each of the 6 possible outcomes directly.
Year 32 - Inventory Report
Speed Challenge
Realizing that the contents on the floor of this puzzle are constant, and it's only the inputs that vary may lead to a solution drastically below the challenge mark.

Year 35 - Duplicate Removal
Speed Challenge
Unrolling your loop sufficiently is good enough to pass.
Year 36 - Alphabetizer
Size Challenge
Copy both strings, compare, setup which to output, output. Can be done within the instruction limit.

Speed Challenge
For best results, determine if the first or second string are going to be output while building the second one.
Year 38 - Digit Exploder
Speed Challenge
Build a harness that subtracts several 100s or 10s at once. Be efficient.
How about trying 500, 200, then repeat 100, and then trying 50, 20, repeat 10.
Year 39 - Re-Coordinator
Dividing by width of the floor and keeping the remainder is all you need here.
Year 40 - Prime Factory
Size Challenge
You are testing for prime integer factors in ascending order. If you did not bother making sure that the factors tested were prime, what would happen?

Speed Challenge
Several possibilities here, considering that the puzzle inputs are going to be max 20. Check the factors involved.

Even a lookup table containing the smallest factor of a given number is feasible. It gives a speed result of ~ 249 instructions.

Year 41 - Sorting Floor
Size Challenge
Simplest ideas have the least instructions. Ideas like Selection Sort[en.wikipedia.org].

Speed Challenge
The lack of subroutines, a stack, and lack of memory on the floor make using most efficient sorting algorithms impractical.
Unrolling loops and some special handling of the last two unsorted items is enough to pass.
noob_Lurker Aug 18 @ 4:12am
oh, nevermind... it's a ZTS, duh. Silly me! :">
noob_Lurker Aug 18 @ 3:41am
Year 32 - Inventory Report ... Not stuck on the Speed Challenge, since the brute-force solution of 76 instructions solves this in 250 steps. Yes, it's quite slower than your "pre-compute the results" idea but it gets the job done. However, i'm stuck at the Size Challenge, i have 11 instructions to build up the board size (13) and 17 instructions to loop through everything. How can i go under 16 total?! o.O
Lupal Fillyus Dec 31, 2017 @ 3:39am
These are just hints for people stuck and want to get A solution, and just want "Solution hints, no spoilers". Were you not able to get a Speed Challenge without the shortcuts you post? Because superfluous hinting hampers the educational value of this game imo. Instead of thinking for themselves, people try to incorporate the hints.
metamorfeus Dec 30, 2017 @ 10:53pm
Year 40: Prime Factory
For 3 < n < 25, all that is required to test primality is if n is not divisible by 2 or 3.
metamorfeus Dec 13, 2017 @ 6:43am
Year 38: Digit Exploder
Handling the boundary condition (n < 10) right after the inbox command can reduce execution time and save hassles when outboxing the separate digits.
metamorfeus Dec 10, 2017 @ 7:03pm
Year 22: Fibonacci Visitor (Speed Challenge)
The input values are never less than 5, so you may safely first output the sequence (1, 1, 2, 3, 5) before entering your main loop.
Lupal Fillyus Feb 26, 2017 @ 4:24pm
@DorcasAurelia "Nah, that hint was too direct."
Which is why I PMed him instead of posting pretty much the solution, which is also why he hasn't returned since 20 Jan.
DorcasAurelia Feb 26, 2017 @ 12:30pm
Karpfador, to reduce commands, don't save anything to memory. Also, don't think of it as comparing the two numbers, think of it as using "Jump if negative" to create a branching tree of possibilities. There aren't 2 possibilities (the signs are the same or the signs are different); there are 4 possible combinations (1: first is - and second is -, 2: first is - and second is +, 3: first is + and second is -, or 4: first is + and second is +)
Lupal Fillyus Jan 26, 2017 @ 7:05am
<deletes comment> Nah, that hint was too direct.
Try to determine the smallest number so far, before you INBOX a new number.
yav_at Jan 25, 2017 @ 2:46am
#23, the littlest number.
I managed to require 7x the amount of command blocks and 5x the steps for beating the challenges. Now I'm stuck thinking of a different method to determine to smallest number in a string.
Currently I'm saving all numbers to memory, -bumping them and +bumping a counter. Once any number hits zero, the counter equals the number and is the required output. (The last string takes forever with the bigger numbers, so I figured this approach has to seem completely ridiculous..)