92LEFT FIRST
The task
a, b, and c share a bus. Y arrives at a, and X at c.
P, on b, must receive X minus Y.
The board
Key idea
Two writers: IN takes the end farther left first, so b reads Y before X.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
When a and c have both written, IN takes a's value first: the one farther left on the bus.
Hint 2Show
MOV B, A keeps the first value in B while b reads the second.
Hint 3Show
SUB B takes B from A, so the value read first is the one taken away.
Solution
Reveal the Full SolutionThe complete program for LEFT FIRST. 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.
aSC-2 standard
IN P0
OUT P1bSC-2 standard
IN P0
MOV B, A
IN P0
SUB B
OUT P1cSC-2 standard
IN P0
OUT P1- CYCLES
- 237
- at par
- ENERGY
- 2106
- at par
- NODES
- 3
- at par
- INSTRUCTIONS
- 9
- at par