53REPLAY
The task
X is a stream of frames of 1 to 3 values, each ended by a 0.
P must receive each frame with its 0, and then the same frame again.
The board
Key idea
A loop of relays is a memory: a frame goes in, comes back round, and is sent again.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
A value stays in a relay until the next core takes it, so the loop is a store.
Hint 2Show
Send the frame round the loop as it goes out to P, the 0 as well.
Hint 3Show
When the frame has gone round, read it back until its 0 comes home.
Solution
Reveal the Full SolutionThe complete program for REPLAY. 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.
mSC-2 standard
S: IN P0
OUT P1
OUT P2
JNZ S
L: IN P3
OUT P1
JNZ Lq1SC-2 standard
IN P0
OUT P1q2SC-2 standard
IN P0
OUT P1q3SC-2 standard
IN P0
OUT P1q4SC-2 standard
IN P0
OUT P1- CYCLES
- 202
- at par
- ENERGY
- 1644
- at par
- NODES
- 5
- at par
- INSTRUCTIONS
- 15
- at par