31INTERCOM
The task
P on the left must receive X plus Y. Q on the right must receive Y minus X.
One wire joins the two cores, and only one end can write to it at a time.
The board
Key idea
Both ends need both values; one speaks first and the reply carries a worked out value.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
If both ends write at once it is a HEAD ON, so let one end speak first.
Hint 2Show
What you send back can be something you worked out, not just what you read.
Hint 3Show
A core that knows one value and the sum can work out the difference.
Solution
Reveal the Full SolutionThe complete program for INTERCOM. 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.
rightSC-2 standard
IN P0
OUT P1
ADD A
MOV B, A
IN P1
SUB B
NEG
OUT P2leftSC-2 standard
IN P1
MOV B, A
IN P0
ADD B
OUT P2
OUT P1- CYCLES
- 547
- at par
- ENERGY
- 3276
- at par
- NODES
- 2
- at par
- INSTRUCTIONS
- 14
- at par
Another way: Left first
A second program that also passes, and matches par on every benchmark.
With the left core speaking first; it gets back Y minus X and works out X plus Y from that.
leftSC-2 standard
IN P0
OUT P1
ADD A
MOV B, A
IN P1
ADD B
OUT P2rightSC-2 standard
IN P1
NEG
MOV B, A
IN P0
ADD B
OUT P2
OUT P1- CYCLES
- 547
- at par
- ENERGY
- 3276
- at par
- NODES
- 2
- at par
- INSTRUCTIONS
- 14
- at par