38PARTY LINE
The task
Each step names an account on X, from 1 to 3, and an amount on Y.
P must receive that account's new balance. Balances start at 0, and account 1 is nearest.
The board
Key idea
Addressed requests down a line of bi hops; each core counts the address down and keeps a balance in B.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
A core can keep its balance in B and still work in A.
Hint 2Show
Take 1 from the account number at each core. The core that reaches 0 owns it.
Hint 3Show
Send the answer back the way the request came.
Solution
Reveal the Full SolutionThe complete program for PARTY LINE. 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 P2
IN P1
OUT P2
IN P2
OUT P3c1SC-2 standard
T: IN P0
SUB 1
JZ M
OUT P1
IN P0
OUT P1
IN P1
OUT P0
JMP T
M: IN P0
ADD B
MOV B, A
OUT P0c2SC-2 standard
T: IN P0
SUB 1
JZ M
OUT P1
IN P0
OUT P1
IN P1
OUT P0
JMP T
M: IN P0
ADD B
MOV B, A
OUT P0c3SC-2 standard
IN P0
IN P0
ADD B
MOV B, A
OUT P0- CYCLES
- 727
- at par
- ENERGY
- 5086
- at par
- NODES
- 4
- at par
- INSTRUCTIONS
- 37
- at par