Instructions[edit]
Strategy[edit]
Another year, another new command: ADD
- ADD
- This instruction is always accompanied by a number. The instruction tells the worker to walk over to the box on the floor labeled with the specified number. The worker will then add the number in his/her hands with the value in the box, and the sum will appear in his/her hands. Note that you cannot instruct the worker to ADD if he/she is not holding anything.
Adding two numbers does precisely what you expect it to do. You should note, however, that whatever was being held in the workers hands is replaced by the sum. That won't affect you now, but down the road, you may need to think about using COPYTO to store that value before it gets lost.
This exercise is similar to the previous one, except that instead of simply storing a value so you can retrieve it later, you're storing the value so that you can add another number to it. You still need to grab the first number off the IN belt and store it somewhere, but then you can grab the second number and add it to the first. The sum will appear in your hands and you can walk over to the OUT conveyor and put it down. Then you can repeat the process, overwriting what you've stored on the floor for the next addition.
a: INBOX COPYTO 0 INBOX ADD 0 OUTBOX JUMP a
Optimizing[edit]
It is not possible to further optimize this solution.
Performance[edit]
Steps Size Speed Goal 6 24 Reached 6 24