17HIGH WATER
The task
P must receive the largest of each value from X and the two before it.
Count 0 before the start. The largest of three is the larger of two neighboring pairs.
The board
Key idea
The largest of the last 3, a moving window over two stages.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
A core that sends the larger of each value and the one before it does half the job.
Hint 2Show
Do it twice in a row and you have the largest of three.
Hint 3Show
XCH keeps the new value in B for next time and puts the old one in A.
Solution
Reveal the Full SolutionThe complete program for HIGH WATER. 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 P1c1SC-2 standard
IN P0
XCH A, B
SUB B
JG K
MOV A, 0
K: ADD B
OUT P1c2SC-2 standard
IN P0
XCH A, B
SUB B
JG K
MOV A, 0
K: ADD B
OUT P1- CYCLES
- 318
- at par
- ENERGY
- 3556
- at par
- NODES
- 3
- at par
- INSTRUCTIONS
- 16
- at par