Simple Turing Machine Interpreter. Supports quadruplet rules. According to Wikipedia:
A Turing machine is a mathematical model of computation that defines an abstract machine that manipulates symbols on a strip of tape according to a table of rules. Despite the model's simplicity, given any computer algorithm, a Turing machine capable of simulating that algorithm's logic can be constructed.
This animation illustrates turing machine performing bitwise and operation on two binary operands. Repository contains "bitwise_and" file with rules required to run this algorithm. Machine copies input data and then performes logical operation on those two operands.
turing-machine.sh <file> <tape_data> [options]
<file>
- file with rules<tape_data>
- initial tape state[options]
- valid options
Available options:
- -s <speed_value_s> sets visualization delay (default: 0.1s)
- --help displays detailed information about using this script
Files with rules should include transitions, each on new line
Transitions should have followng structure: [st1,sym,ins,st2]
- st1 - current_state (alphanumeric)
- sym - symbol currently seen on a tape
- ins - instruction or symbol to write
- st2 - next state (alphanumeric)
Instructions are used to control head and finish execution
- > - head should move to the right
- < - head should move to the left
- = - head should stay at the same place
- # - instruction finishes execution
- Machine tape is left limited
- Each command should be stated in a newline
- Script detects trivial loops
- Script detects indeterminant transitions
- You can leave comments in rules using #