99DOUBLE DECK
The task
a reads X, and c reads Y. b sits on both buses.
P, on d, must receive the larger of X and Y, and Q, on e, the smaller.
The board
Key idea
Two buses: b reads X and Y on one and writes the larger, then the smaller, on the other, where d must rest.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
b reads X before Y: when both are waiting, a's goes first, as a is farther left.
Hint 2Show
On the lower bus, d is farther left than e, so d takes whatever b writes first.
Hint 3Show
Once d has its value, it must stay off the bus until e has taken the other.
Solution
Reveal the Full SolutionThe complete program for DOUBLE DECK. 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 P1dSC-2 standard
IN P0
OUT P1
NOPbSC-2 standard
IN P0
MOV B, A
IN P0
SUB B
JG L
ADD B
XCH A, B
JMP O
L: ADD B
O: OUT P1
XCH A, B
OUT P1cSC-2 standard
IN P0
OUT P1eSC-2 standard
IN P0
OUT P1- CYCLES
- 476
- at par
- ENERGY
- 4440
- at par
- NODES
- 5
- at par
- INSTRUCTIONS
- 21
- at par