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

Instructions[edit]

Busy Mail Room

Grab each thing from the INBOX, and drop each one into the OUTBOX.

You got a new command! You can drag JUMP's arrow to jump to different lines within your program.

With this new ability you can complete this assignment using only 3 total commands.

Strategy[edit]

This year you are introduced to your third instruction: JUMP.

JUMP
When your worker encounters the jump command, he will "jump" to the instruction that follows after the blue box which you can drag to another point in your program. You can have the worker jump to a previous instruction in the program, or skip ahead to other instructions further below.

The first time you try this program, you have an unspecified number of items on the IN conveyor. Since you don't know how many items you need to transfer, you'll want to write a program that continuously grabs from the IN conveyor belt, and drops to the OUT conveyor belt until you run out of items. A program will always stop if the worker hits an INBOX instruction, but there is nothing left on the IN conveyor belt.

To do this, we must use the JUMP command. After executing an INBOX and then an OUTBOX, we must JUMP back to the start of the program. This creates a loop, and the worker will continuously execute those instructions until the IN conveyor is empty. (When these solutions are typed out, the JUMP command will include a label, and the program will jump to that label. In the following case, when "JUMP a" is reached, the program will start back over at "a:" above the INBOX command.)

a:
   INBOX   
   OUTBOX  
   JUMP     a

Optimizing[edit]

When you get far enough in the game (year 7), you will be told that you will be graded on the size of your program, as well as its efficiency. In some cases, it's not possible to achieve acceptable scores for both criteria with the same program. This year is one such case.

While you can solve the problem with as few as three instructions, that's three instructions per letter. The average case that you're being compared with has ten letters. Three instructions for ten letter is 30 steps. You're being asked to do it in 25 or fewer.

The way to do so is called "loop unrolling". The trick is to do more work per JUMP instruction. Because you need one INBOX and one OUTBOX instruction per letter, you can only optimize the program by using fewer JUMPs for the same work.

a:
   INBOX   
   OUTBOX  
   INBOX   
   OUTBOX 
   JUMP     a

If doing so, you need five instructions for every two letters. Five times five instructions moves ten letters using 25 instructions. Using more INBOX / OUTBOX instructions in the loop further reduces the runtime but the effect gets weaker.

Performance[edit]

Steps     Size      Speed
Goal        3         30
Reached     5         25