96HANDSHAKE
The task
a, b, and c share a bus. X arrives at a, and Y at c.
P on a must receive X plus Y, Q on c X minus Y, and R on b X times Y.
The board
Key idea
Each value is needed twice: one side speaks while the other listens, then they swap; all writing at once is HEAD ON.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Each value is needed by two cores, so each goes out on the bus twice.
Hint 2Show
If a and c both write first, b alone reads, and it takes a's value both times.
Hint 3Show
Let one side speak while the other listens, then swap.
Solution
Reveal the Full SolutionThe complete program for HANDSHAKE. 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
MOV B, A
IN P1
ADD B
OUT P2
MOV A, B
OUT P1
OUT P1bSC-2 standard
IN P0
MOV B, A
IN P0
MUL B
OUT P1cSC-2 standard
IN P0
OUT P1
OUT P1
MOV B, A
IN P1
SUB B
OUT P2- CYCLES
- 547
- at par
- ENERGY
- 4680
- at par
- NODES
- 3
- at par
- INSTRUCTIONS
- 20
- at par