S38TIGHT SQUEEZE
The task
The clamp, swapped about. Swap its pieces back.
P must receive each X held between -20 and 60: lower values become -20, higher ones 60.
The board
Key idea
Par is 7 swaps. Core h needs 3 instruction swaps and 4 operand swaps. 4 of them trade two tiles that hold each other's places; look for those first, since one swap mends both.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
SUB 60 puts the top of the range at 0, and a value still above 0 is cut to 0.
Hint 2Show
ADD 80 then puts the bottom of the range at 0, and a value below it is cut to 0.
Hint 3Show
SUB 20 brings the value back to where it belongs.
Solution
Reveal the Full SolutionThe complete program for TIGHT SQUEEZE. Open it only when you want the answer.
The board as dealt
This is the arrangement the game deals. Framed tiles are the ones out of place.
cSC-1 lite
IN P0
OUT P1hSC-2 standard
JL P0
IN 60
ADD 20
MOV 0, P1
L: SUB 0
JG G
MOV A, 80
G: SUB L
OUT A7 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
h, swap the operand20on line 3 withLon line 8. - In core
h, swap the operand0on line 5 with80on line 7. - In core
h, swap the operand0on line 4 withAon line 9. - In core
h, swap the operandP1on line 4 with0on line 9. - In core
h, swap the instructionJLon line 1 withINon line 2. - In core
h, swap the instructionJLon line 2 withSUBon line 5. - In core
h, swap the instructionADDon line 3 withJLon line 5.
The finished program
Every tile back in place: the reference solution, which scores exactly par on every benchmark.
cSC-1 lite
IN P0
OUT P1hSC-2 standard
IN P0
SUB 60
JL L
MOV A, 0
L: ADD 80
JG G
MOV A, 0
G: SUB 20
OUT P1- CYCLES
- 332
- at par
- ENERGY
- 1970
- at par
- NODES
- 2
- at par
- INSTRUCTIONS
- 11
- at par
- SWAPS
- 7
- at par