73ENCODER
The task
P must receive a code for each X sample: 1 if X is at or above the level, -1 if below.
The level and its step follow SLOPE, from a level of 0 and a step of 1.
lv is an SC-2D, with slow jumps, and st is an SC-4, with registers C and D.
The board
Key idea
Feedback: the encoder runs a copy of SLOPE's decoder to know the level the receiver will hear.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
An encoder must know what the receiver will hear, so it runs a copy of the decoder.
Hint 2Show
As in SLOPE, three matching codes in a row double the step, and any other code makes it 1.
Hint 3Show
lv keeps the level and sends the gap first, cmp makes the code, and st makes the step.
Solution
Reveal the Full SolutionThe complete program for ENCODER. 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.
lvSC-2D signal processor
IN P0
SUB B
OUT P1
IN P2
ADD B
MOV B, AcmpSC-2 standard
IN P0
JL LO
MOV A, 1
JMP GO
LO: MOV A, -1
GO: OUT P2
OUT P1stSC-4 quad
IN P0
XCH A, C
XCH A, D
ADD D
SUB C
SUB C
JNZ ONE
MOV A, B
ADD B
JMP GO
ONE: MOV A, 1
GO: MOV B, A
MUL C
OUT P1- CYCLES
- 876
- at par
- ENERGY
- 6757
- at par
- NODES
- 3
- at par
- INSTRUCTIONS
- 27
- at par