From StrategyWiki, the video game walkthrough and strategy guide wiki
Jump to navigation Jump to search

Instructions[edit]

String Storage Floor
Each thing in the INBOX is an address of a tile on the floor. For each address provided in the INBOX, OUTBOX the requested item from the floor and ALL FOLLOWING items on the floor until you reach a ZERO. Repeat!

Strategy[edit]

In this stage, you will once again pick a number off the conveyor belt and use indirect access to grab letters from the floor. This time however, after every time you grab a letter, you'll need to increment the number you placed in the box, and continue to grab letters from the floor until you encounter a zero. At that time, you'll grab a new number from the INBOX and start the process all over. There's only one available box for placing the number in, and that's box 24.

a:
   INBOX   
   COPYTO   24
b:
   COPYFROM [24]
   JUMPZ    a
   OUTBOX  
   BUMPUP   24
   JUMP     b

Optimizing[edit]

It is possible to optimize the speed at the expense of the size of this solution.

a:
    INBOX   
    COPYTO   24
    COPYFROM [24]
b:
    OUTBOX  
    BUMPUP   24
    COPYFROM [24]
    JUMPZ    a
    JUMP     b

The above solution will work in either case. However, in the case shown in the game, one more optimization of the solution can be made so that the average number of steps is even lower. The character map in memory is invariant, and thus it is known that the longest string will be 5 (characters from 11 to 15). Knowing this, one can skip the loops and decompose the cases for all solutions up to 5 characters, which looks as follows:


a:
b:
c:
d:
e:
f:
   INBOX   
   COPYTO   24
   COPYFROM [24]
   JUMPZ    a
   OUTBOX  
   BUMPUP   24
   COPYFROM [24]
   JUMPZ    b
   OUTBOX  
   BUMPUP   24
   COPYFROM [24]
   JUMPZ    c
   OUTBOX  
   BUMPUP   24
   COPYFROM [24]
   JUMPZ    d
   OUTBOX  
   BUMPUP   24
   COPYFROM [24]
   JUMPZ    e
   OUTBOX  
   BUMPUP   24
   COPYFROM [24]
   JUMPZ    f
   OUTBOX