49LEADER
The task
Three stations stand in a ring, and each one hears its own stream.
P and Q must each receive the largest of X, Y and Z.
The board
Key idea
A value goes round a ring, picking up the largest, and the answer comes back round to the first two stations.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Pass the largest so far round the ring, one station at a time.
Hint 2Show
The last station knows the answer, and the ring brings it back to the others.
Hint 3Show
If every station writes before it reads, the ring stops dead.
Solution
Reveal the Full SolutionThe complete program for LEADER. 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 P2
IN P3
OUT P1
OUT P2bSC-2 standard
IN P0
MOV B, A
IN P2
SUB B
JL L
ADD B
MOV B, A
L: MOV A, B
OUT P3
IN P2
OUT P1cSC-2 standard
IN P0
MOV B, A
IN P1
SUB B
JL L
ADD B
MOV B, A
L: MOV A, B
OUT P2- CYCLES
- 836
- at par
- ENERGY
- 5466
- at par
- NODES
- 3
- at par
- INSTRUCTIONS
- 25
- at par