human-resource-machine-solutions has all my solutions to the puzzle game "Human Resource Machine". To my understanding, "Human Resource Machine" is a fun game simulating assembly programming. I really enjoy seeing how it works, knowing the restricted set of command and optimizing solutions for speed and/or size. Here, I record my exciting journey.
This collection is just my own solutions, not necessarily the best. For the best and the most comprehensive collection of solutions, I would go to this repo and its website.
- Two interesting ideas/concepts I've learned from others:
- "Loop unrolling": a space-time tradeoff which optimize speed at the expense of size. Learned from the Steam forum and used in the solution for year 2
- Optimize speed by jumping back (save one jump step) and skipping the first output: learned from another solution and used in solutions for year 9, year 13 and year 16. To understand the difference, compare the following two:
-
Straightforward code
a: b: INBOX JUMPZ c JUMP b c: OUTBOX JUMP a
-
Optimized code
JUMP b a: OUTBOX b: c: INBOX JUMPZ a JUMP c
For each run, optimized code has one more
JUMP
than straightforward code. However, for each zero output, optimized code saves oneJUMP
by jumping up back directly. Therefore, as long as there is one zero output, optimized code won't be worse than straightforward code.
-
- Selected interesting challenges
Challenges | Notes |
---|---|
Year 28 - size | Pair-wise comparison for every new number; use the storage without swapping numbers. |
Year 40 | Initialize a slot with "1" for odd number sequence after processing "2". |
Year 41 | Pair-wise comparison for every new number |