76SIDE WIRE
The task
X runs from 0 to 7. Below 4, P must receive X cubed; from 4 up, 100 minus X squared.
c and s are SC-2Ls: 2 cycles an instruction, at half the energy.
h and j are SC-1s: register A only, 8 lines.
The board
Key idea
A decision travels on a wire of its own: the dealer tells the collector which lane each value took.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
The middle wire lets h tell j which lane each value took, so j knows where to read.
Hint 2Show
h can send X minus 4: its sign picks the lane, and each lane adds the 4 back.
Hint 3Show
Send the value to its lane before you tell j, so the lane can start while j still waits.
Solution
Reveal the Full SolutionThe complete program for SIDE WIRE. 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-1 lite
S: IN P0
SUB 4
JL K
OUT P3
OUT P2
JMP S
K: OUT P1
OUT P2cSC-2L low power
IN P0
ADD 4
MOV B, A
MUL A
MUL B
OUT P1sSC-2L low power
IN P0
ADD 4
MUL A
NEG
ADD 100
OUT P1jSC-1 lite
S: IN P1
JL K
IN P2
OUT P3
JMP S
K: IN P0
OUT P3- CYCLES
- 446
- at par
- ENERGY
- 1881
- at par
- NODES
- 4
- at par
- INSTRUCTIONS
- 27
- at par
Another way: One lane
A second program that also passes. It beats par on ENERGY, NODES, and INSTRUCTIONS and gives some back on CYCLES.
C does both jobs itself and the middle wire stays idle: one core fewer, far fewer lines and less energy, but one slow lane does all the work.
hSC-1 lite
IN P0
OUT P1cSC-2L low power
IN P0
SUB 4
JL K
ADD 4
MUL A
NEG
ADD 100
JMP O
K: ADD 4
MOV B, A
MUL A
MUL B
O: OUT P1jSC-1 lite
IN P0
OUT P3- CYCLES
- 713
- over par
- ENERGY
- 1468
- under par
- NODES
- 3
- under par
- INSTRUCTIONS
- 17
- under par