On the Subject of int##
The string of numbers in the screen represents a program — a series of instructions — that computes a string of three digits 0–9. Trace the execution of the program (starting with the instruction on the far left) to obtain the three digits computed, then use the instruction buttons to enter the result.
The three digits start out at 0. There is also a pointer pointing at one of the digits which initially points at the first.
There is also a “state” value which is initially 0.
Once the state is 5, the program terminates.
|0||Move the pointer to the middle digit.|
|1||If the current state is 0, jump to the instruction '2' in the program, and the state becomes 1. Otherwise, do nothing.|
|2||The current state changes as follows: 0 becomes 3, 2 becomes 3, 4 becomes 5. Other values remain unchanged.|
|3||Move the pointer one digit left (wrapping around as necessary).|
|4||If the current digit is 9, it becomes 0, otherwise it is incremented.|
|5||Move the pointer one digit right (wrapping around as necessary).|
|6||Move the pointer to the leftmost digit.|
|7||If the current digit is 0, it becomes 9, otherwise it is decremented.|
|8||Move the pointer to the rightmost digit.|
|9||All digits are incremented (except digits that were 9 become 0).|
(This is when execution hits the end of the program.)
The current state changes as follows: 1 becomes 2, 3 becomes 4. Other values remain unchanged. Then jump to the '1' instruction.