100LAST STOP
The task
X and Y are from 1 to 99. P over Q must be X over Y in lowest terms.
The upper bus joins a, b, and c, and the lower bus d, e, and f.
The board
Key idea
Lowest terms over two buses: each divisor writer tells its feeder on a link when to send the next value.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Divide X and Y by the largest number that divides both; a loop of MOD B and XCH finds it.
Hint 2Show
c and f each need a value and that divisor, so a and d send theirs twice.
Hint 3Show
If a writes its next X before c has the divisor, c takes the X. b can tell a when to go.
Solution
Reveal the Full SolutionThe complete program for LAST STOP. 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.
aSC-2 standard
IN P0
OUT P1
OUT P1
IN P2bSC-2 standard
IN P0
OUT P1
IN P1
OUT P0
OUT P2cSC-2 standard
IN P0
MOV B, A
IN P0
XCH A, B
DIV B
OUT P1dSC-2 standard
IN P0
OUT P1
OUT P1
IN P2eSC-2 standard
IN P1
MOV B, A
IN P0
L: MOD B
JZ G
XCH A, B
JMP L
G: XCH A, B
OUT P0
OUT P1
OUT P2fSC-2 standard
IN P0
MOV B, A
IN P0
XCH A, B
DIV B
OUT P1- CYCLES
- 1033
- at par
- ENERGY
- 10700
- at par
- NODES
- 6
- at par
- INSTRUCTIONS
- 36
- at par