43HEADCOUNT
The task
P must receive how many of Y, Z, and W are less than X.
The core with X reaches each of the others on its own wire.
The board
Key idea
Broadcast one value on three bi wires and add the answers.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Send X out to each core, then read three answers.
Hint 2Show
An answer of 1 or 0 can just be added up.
Hint 3Show
A tie is not less.
Solution
Reveal the Full SolutionThe complete program for HEADCOUNT. 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
IN P0
OUT P1
OUT P2
OUT P3
IN P1
MOV B, A
IN P2
ADD B
MOV B, A
IN P3
ADD B
OUT P4lbSC-2 standard
IN P1
MOV B, A
IN P0
SUB B
JL L
MOV A, 0
JMP O
L: MOV A, 1
O: OUT P1lcSC-2 standard
IN P1
MOV B, A
IN P0
SUB B
JL L
MOV A, 0
JMP O
L: MOV A, 1
O: OUT P1ldSC-2 standard
IN P1
MOV B, A
IN P0
SUB B
JL L
MOV A, 0
JMP O
L: MOV A, 1
O: OUT P1- CYCLES
- 730
- at par
- ENERGY
- 8048
- at par
- NODES
- 4
- at par
- INSTRUCTIONS
- 39
- at par