55LEVEL
The task
X is a stream of frames of 1 to 3 values from -15 to 15, each ended by a 0.
P must receive each value minus the smallest value in its frame. No 0 goes to P.
The board
Key idea
The smallest is only known at the end, so the frame waits in the loop and is read back.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
The smallest value is only known at the end of the frame, so store the frame first.
Hint 2Show
Keep the smallest so far in B. Start it above anything X can send.
Hint 3Show
Send the 0 round too, so you know when the stored frame has come home.
Solution
Reveal the Full SolutionThe complete program for LEVEL. Open it only when you want the answer.
The reference program
The game's own solution. It passes every test and scores exactly par on every benchmark.
mSC-2 standard
R: MOV A, 100
MOV B, A
S: IN P0
OUT P2
JZ L
SUB B
JG S
ADD B
MOV B, A
JMP S
L: IN P3
JZ R
SUB B
OUT P1
JMP Lq1SC-2 standard
IN P0
OUT P1q2SC-2 standard
IN P0
OUT P1q3SC-2 standard
IN P0
OUT P1q4SC-2 standard
IN P0
OUT P1- CYCLES
- 453
- at par
- ENERGY
- 3996
- at par
- NODES
- 5
- at par
- INSTRUCTIONS
- 23
- at par