Instructions
- Begin by initializing the machine.
- Request more than the amount of tape length required. You have to start over if the head moves outside the tape.
- Enter the starting position of the read/write head on the tape. The head should be within the tape.
- Optionally enter the intial contents of the tape. Enter a string the same length as the tape and use underscore for blank space. For example: initializing the tape of length 5 with red starting at position 3 should be __red. Leaving this field blank creates a blank tape.
- Enter the tuples that define the machine, one in each line, in the following format - current_state,read,write/move,next_state. States can only be numeric. The difference between write and move is as follows:
- /R or /r causes the tape head to move right.
- /L and /l causes the tape head to move left.
- All other characters are written to the tape.
- Enter a value for the initial state of the machine.
- Click "Initialize Machine".
- If all values entered were valid, the machine will appear on the right pane.
- Enter a value for the number of steps to simulate the machine and click on "Step Machine".
- Updating/editing the tuples at any point will be reflected the next time the machine is stepped.
- Enter a new tape length and head starting position and click "Initialize Machine" to start over.
- NOTE: If you have the tuples format correct and still get an error message, check if there is an empty line at the end
You can simulate a one-way finite state machine using this same system, by setting the third element of all tuples to /R or /L appropriately |
Examples
Write String Addition
- Set tape length to 10 and head position to 1. No initial contents.
- Enter the following tuples
0,_,W,0
0,W,/r,1
1,_,H,1
1,H,/r,2
2,_,O,2
2,O,/r,3
3,_,A,3
3,A,/r,4
4,_,!,4
4,!,/r,5
- Enter initial state as 0
- Click "Initialize Machine"
- Enter number of steps as 1
- Keep clicking "Step Machine" until machine completes writing the string and halts.
- This example of addition represents 2 as ** and 3 as ***, to perform 2+3
- Set tape length to 8 and starting position to 2. Also enter initial tape contents as _**_***_
- Enter the following tuples
0,*,/r,0
0,_,*,1
1,*,/r,1
1,_,/l,2
2,*,_,2
- Enter initial state as 0.
- Click "Initialize Machine".
- Enter number of steps as 1.
- Keep clicking "Step Machine" until the machine halts.
Quick exercise: Add another tuple to this list such that the machine does not give an error at the end of the task, but instead stays in a particular state indefinitely. |