77SPOKES
The task
P must receive 2 times X cubed, minus 3 times X squared, minus 11 times X, plus 6.
s1, s2, and s3 are SC-2Ls: 2 cycles an instruction, at half the energy.
Each spoke has one two way wire to h: a job goes out on it and the answer comes back.
The board
Key idea
A hub on two way spokes sends a job down every spoke before it waits for any answer.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Send a job down every spoke before you wait for any answer.
Hint 2Show
Read each answer before you send that spoke its next job, or the wire is HEAD ON.
Hint 3Show
Work from the inside out: 2X minus 3, times X, minus 11, times X, plus 6.
Solution
Reveal the Full SolutionThe complete program for SPOKES. 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
IN P0
OUT P2
IN P0
OUT P3
IN P1
OUT P4
IN P2
OUT P4
IN P3
OUT P4s1SC-2L low power
IN P0
MOV B, A
MUL 2
SUB 3
MUL B
SUB 11
MUL B
ADD 6
OUT P0s2SC-2L low power
IN P0
MOV B, A
MUL 2
SUB 3
MUL B
SUB 11
MUL B
ADD 6
OUT P0s3SC-2L low power
IN P0
MOV B, A
MUL 2
SUB 3
MUL B
SUB 11
MUL B
ADD 6
OUT P0- CYCLES
- 365
- at par
- ENERGY
- 1989
- at par
- NODES
- 4
- at par
- INSTRUCTIONS
- 39
- at par
Another way: Alone
A second program that also passes. It beats par on NODES and INSTRUCTIONS and gives some back on CYCLES and ENERGY.
H works out every value itself: one core and 9 lines, but h spends 2 energy an instruction and still falls behind the three spokes.
hSC-2 standard
IN P0
MOV B, A
MUL 2
SUB 3
MUL B
SUB 11
MUL B
ADD 6
OUT P4- CYCLES
- 391
- over par
- ENERGY
- 2106
- over par
- NODES
- 1
- under par
- INSTRUCTIONS
- 9
- under par