Extracts from the comments:
The input and input is in unary as a string of 1
. Space is 0
. The output should rewrite the input.
The input is {x, 3} with one space between each argument or {x}.
The output is {x mod 3}.
Algorithm:
- Go to the end of the input.
- Remove the second argument.
- While there are at least three symbols in the argument, remove them.
State machine:
- Start: If input is 0, move right and go to "deleting right", else move right.
- Deleting right: If input is 0, move left and go to "finding arg". Else write 0 and move right.
- Finding arg: If input is 0, move left. If input is "start of tape", finish. Else move left and go to state "found 1".
- Found 1: If input is "start of tape", finish. Else move left and go to the state "found 2"
- Found 2: If input is "start of tape", finish. Else and go to the state "deleting right".