Turing machine simulator
[ Back to home page ]
This is a Turing machine simulator.
To use it:
To use it:
- Load one of the example programs , or write your own in the Turing machine program area. See below for syntax .
- Enter something in the ‘Input’ area – this will be written on the tape initially as input to the machine. Click ‘Reset’ to initialise the machine.
- Click on ‘Run’ to start the Turing machine and run it until it halts (if ever).
Click on ‘Pause’ to interrupt the Turing machine while it is running.
Alternately, click ‘Step’ to run a single step of the Turing machine.
- Click ‘Reset’ to restore the Turing machine to its initial state so it can be run again.
Turing machine program
Run at full speed
Changes will take effect when the machine is reset.
Load an example program
- Palindrome detector
- Binary addition
- Binary multiplication
- Binary to decimal conversion
- Turing’s sequence machine
- Parentheses checker
- Reverse Polish Boolean calculator
- Primality test
- 4-state busy beaver
- Universal Turing machine
Save to the cloud
- Each line should contain one tuple of the form ‘
<current state> <current symbol> <new symbol> <direction> <new state>‘.
- You can use any number or word for
<new state>, eg.
10, a, state1. State labels are case-sensitive.
- You can use any character for
<new symbol>, or ‘
_‘ to represent blank (space). Symbols are case-sensitive.
<direction>should be ‘
r‘ or ‘
*‘, denoting ‘move left’, ‘move right’ or ‘do not move’, respectively.
- Anything after a ‘
;‘ is a comment and is ignored.
- The machine halts when it reaches any state starting with ‘
*‘ can be used as a wildcard in
<current state>to match any character or state.
*‘ can be used in
<new state>to mean ‘no change’.
!‘ can be used at the end of a line to set a breakpoint, eg ‘
1 a b r 2 !‘. The machine will automatically pause after executing this line.
- You can specify the starting position for the head using ‘
*‘ in the initial input.
Source code for this simulator is available on GitHub . You are welcome to download, copy, or adapt the code to your own needs. If you are doing something interesting with it, I’d be happy to hear from you about it.
The previous version of the Turing machine simulator is still available here .
Please send any bug reports, feedback, suggestions, etc. to Anthony Morphett , awmorp @ gmail.com
— Anthony Morphett – awmorp @ gmail.com