16RING BUFFER
The task
P must receive each value from X minus the one three places before it.
Count 0 before the start. The cores form a one way ring, and what you send comes back.
The board
Key idea
A ring of one way links; one core must read first or the ring deadlocks.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Each core on the ring can hold one value and pass on the one it held.
Hint 2Show
If every core on a ring sends first, all of them wait for a reader. One must read first.
Hint 3Show
Send the new value around, then subtract what comes back.
Solution
Reveal the Full SolutionThe complete program for RING BUFFER. 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.
c0SC-2 standard
IN P0
OUT P2
MOV B, A
IN P3
SUB B
NEG
OUT P1c1SC-2 standard
IN P0
XCH A, B
OUT P1c2SC-2 standard
IN P0
XCH A, B
OUT P1c3SC-2 standard
IN P0
XCH A, B
OUT P1- CYCLES
- 625
- at par
- ENERGY
- 3744
- at par
- NODES
- 4
- at par
- INSTRUCTIONS
- 16
- at par