37SAFE CRACKER
The task
Send guesses to the judge. It answers -1 when a guess is low, 1 when high, and 0 when right.
P must receive each secret in turn. Secrets run from 0 to 99.
The board
Key idea
Search against a locked judge that answers low, high, or right; no outputs until a find.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Keep the guess in B while A reads the answer.
Hint 2Show
Big steps up, then single steps down, will find any secret.
Hint 3Show
After a find, the vault moves on to its next secret.
Solution
Reveal the Full SolutionThe complete program for SAFE CRACKER. 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.
guessSC-2 standard
G: OUT P0
MOV B, A
IN P0
JZ F
JG DN
XCH A, B
ADD 10
JMP G
DN: XCH A, B
SUB 1
JMP G
F: XCH A, B
OUT P1- CYCLES
- 15035
- at par
- ENERGY
- 43036
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 13
- at par