Human Resource Machine/Year 13

Strategy
Clearly, comments are not a new command. They are simply a tool for you, as the author of a program, to help you keep portions of your program straight in your mind. Programmers use comments to help themselves and other programmers quickly identify what a potentially confusing section of code is trying to do.

In order to properly detect if two values are the same, there's a simple test we can perform. If we subtract two numbers, and the answer is zero, they must have been equal. Therefore, you can grab one number from the INBOX, store it somewhere, and then grab a second number and subtract it from the first. If the value is zero, we want to pick that number back up from the box and bring it to the OUTBOX. Otherwise, we ignore the unequal numbers and move on.

a: b:   INBOX COPYTO  0 INBOX SUB     0 JUMPZ   c    JUMP     b c:    COPYFROM 0 OUTBOX JUMP    a

Optimizing
As with, your first solution may meet the size challenge, but it may fall slightly short of the speed challenge. So just like we did in Year 9, we can speed the program up by eliminating the jump between the OUTBOX instruction and the INBOX instruction. To do this, we move a few of the instructions to the top, and then jump over them for the very first execution of the program, like so:

JUMP    b a:    COPYFROM 0 OUTBOX b: c:   INBOX COPYTO  0 INBOX SUB     0 JUMPZ   a    JUMP     c

Additional Optimization
We can speed up the program even further by eliminating the first jump and adding some redundancy.

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

Performance
Steps    Size      Speed Goal       9         27 Reached    9         26