S04LOOSE STEPS
The task
The staircase program is all here, swapped about. Put it back together.
Build a staircase on CH1: five steps from 0 to 5 volts, then start over.
Climb one step on each tick of P1. P0 is a PWM pin into R1 and C1.
The board
- Resistors
- R1 1 kΩ
- Capacitors
- C1 1 µF
- Probes
- CH1
Key idea
Par is 3 swaps. Core u1 needs 2 instruction swaps and 1 operand swap. Every one of them trades two tiles that hold each other's places, so each swap mends two.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Each swap compiles at once, and the circuit runs whatever you have.
Hint 2Show
Each step is a quarter of the supply: 25 percent more duty.
Hint 3Show
MOV B, A copies A into B, and MOV A, B copies it back, so B can hold the duty between ticks.
Solution
Reveal the Full SolutionThe complete program for LOOSE STEPS. 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.
u1SC-2 standard
MOV A, B
IN P0
JNZ 25
MOV B, A
SUB A
ADD W
MOV B, 125
W: OUT P13 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
u1, swap the operandAon line 5 with125on line 7. - In core
u1, swap the instructionINon line 2 withOUTon line 8. - In core
u1, swap the instructionJNZon line 3 withADDon line 6.
The finished program
Every tile back in place: the reference solution, which scores exactly par on every benchmark.
u1SC-2 standard
MOV A, B
OUT P0
ADD 25
MOV B, A
SUB 125
JNZ W
MOV B, A
W: IN P1- CYCLES
- 72
- at par
- ENERGY
- 144
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 8
- at par
- SWAPS
- 3
- at par