30METER
The task
The locked meter adds each value it gets, writes its total to P, and sends the total back.
P must show the running total of X, back to 0 after each 0.
The board
Key idea
Cancel a locked adder's total by sending it back negated; read each reply before the next send.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
The meter can only add. To bring its total to 0, send the total with its sign flipped.
Hint 2Show
Keep the last total the meter sent back in B.
Hint 3Show
Read the meter's answer before you send the next value.
Solution
Reveal the Full SolutionThe complete program for METER. 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.
feedSC-2 standard
T: IN P0
JZ N
OUT P1
IN P1
MOV B, A
JMP T
N: XCH A, B
NEG
OUT P1
IN P1- CYCLES
- 426
- at par
- ENERGY
- 1386
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 10
- at par