10SWITCHBOARD
The task
You are the operator. Each locked caller sends two values and waits for their sum.
Callers do not take turns, so stay on the line with the caller you picked.
The board
Key idea
ANY and LAST: serve whoever calls, then stay on that line.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
IN ANY reads from whichever caller has a value waiting.
Hint 2Show
LAST is the pin ANY used. IN LAST reads the second value from the same caller.
Hint 3Show
OUT LAST sends the sum back to that caller.
Solution
Reveal the Full SolutionThe complete program for SWITCHBOARD. 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.
opSC-2 standard
IN ANY
MOV B, A
IN LAST
ADD B
OUT LAST- CYCLES
- 126
- at par
- ENERGY
- 380
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 5
- at par
Another way: Reply any
A second program that also passes, and matches par on every benchmark.
Under TIS-100 rules an ANY reply also reaches the right caller here: only the caller being served is reading, so it is the first reader. LAST is needed for the pair.
opSC-2 standard
IN ANY
MOV B, A
IN LAST
ADD B
OUT ANY- CYCLES
- 126
- at par
- ENERGY
- 380
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 5
- at par