Human Resource Machine

Human Resource Machine

Not enough ratings
Year 28 - Three Sort - Time Optimized: Hints & Solution
By McPunchins
This is a guide on how to Time Optimize Year 28 of Human Resource Machine
   
Award
Favorite
Favorited
Unfavorite
Tips, Tricks, Hints
Strategy

I found the trick to this was to build a massive program that accounted for every possible combination of values then cut away fluff by condensing lines before jumps where they could be until the program becomes faster than the challenge. It is a slow process of starting massively verbose then becoming smaller.

The first step I used was to isolate one of the three values as my initial comparison value between the first two. There is a logical choice here which I won't spoil. Then the second step was to create comments for every possible combination (Ex: A < B ? C) And start working the logic out for getting to each step from the last step and what should happen in each. Once you have achieved a working algorithm then you can begin to optimize by looking for places where you are doing something to the value in hand that is a waste of time if you do something else before it. (Ex: Why add a value back to it just to store it?)

Tips:

Don't be afraid to brute force the first run.

This is going to take some time, and everything you try may not work out as you'd hoped.

Back Up Your Code. Every step you make toward a positive outcome make a copy of the program in case the next optimization attempt breaks the program. This will save you the headache of trying to back button to a working solution again because the program is going to be massive.
Solution *** SPOILERS ***
TIME OPTIMIZED SOLUTION

-- HUMAN RESOURCE MACHINE PROGRAM --

a:
b:
c:
d:
e:
f:
INBOX
COPYTO 0
INBOX
COPYTO 1
SUB 0
JUMPN g
JUMP k
g:
COMMENT 1
INBOX
COPYTO 2
SUB 1
JUMPN h
JUMP i
COMMENT 0
h:
ADD 1
OUTBOX
COPYFROM 1
OUTBOX
COPYFROM 0
OUTBOX
JUMP d
i:
COMMENT 2
COPYFROM 1
OUTBOX
COPYFROM 2
SUB 0
JUMPN j
COMMENT 3
COPYFROM 0
OUTBOX
COPYFROM 2
OUTBOX
JUMP f
j:
COMMENT 5
COPYFROM 2
OUTBOX
COPYFROM 0
OUTBOX
JUMP e
k:
COMMENT 4
INBOX
COPYTO 2
SUB 1
JUMPN l
COMMENT 6
COPYFROM 0
OUTBOX
COPYFROM 1
OUTBOX
COPYFROM 2
OUTBOX
JUMP c
l:
COMMENT 7
ADD 1
JUMPN p
SUB 0
JUMPN n
m:
COMMENT 8
COPYFROM 0
OUTBOX
COPYFROM 2
OUTBOX
COPYFROM 1
OUTBOX
JUMP b
n:
o:
COMMENT 9
ADD 0
OUTBOX
COPYFROM 0
OUTBOX
COPYFROM 1
OUTBOX
JUMP a
p:
COMMENT 10
SUB 0
JUMPN o
JUMP m