23SELECTOR
The task
When X is 0, P takes the next Y. Otherwise P takes the next Z.
Both streams are used up either way. Only the hub sees X, and Z can be zero too.
The board
Key idea
Multiplex with a flag word, since any value can be data; drain the unused stream.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
The output core cannot tell a choice from a value unless you tell it which is which.
Hint 2Show
Send X on first as the flag, then the value if there is one.
Hint 3Show
A value nobody picked still has to be read, or the streams fall out of step.
Solution
Reveal the Full SolutionThe complete program for SELECTOR. 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.
hSC-2 standard
T: IN P0
OUT P1
JZ N
IN P2
OUT P1
JMP T
N: IN P2c2SC-2 standard
IN P0
OUT P1c1SC-2 standard
T: IN P2
JZ N
IN P0
IN P2
OUT P1
JMP T
N: IN P0
OUT P1- CYCLES
- 275
- at par
- ENERGY
- 2888
- at par
- NODES
- 3
- at par
- INSTRUCTIONS
- 17
- at par