Turing machine simulator written in C++
Compile the program with make on UNIX systems. Can also be compiled on windows manually with cl.
The program includes a ncurses GUI, so make sure you have the appropriate header files (libncurses-dev on Ubuntu)
If you run the program with no arguments, it will start in command line mode. If you run it with the parameter -gui it will start in ncurses mode. Make sure to have at least a terminal that is 120x35 for the best experience.
In command mode, you can enter the following commands (with the alias indicated between brackets):
load (<) [path]: load program from filesave (>) [path]: save the current program to filerun (r): execute the machine till it goes to a halt statestep (s) [nsteps]: executenstepscomputations steps. Default 1.memorysize [nbytes]: set the size of the tape tonbytesinitialsymbol [symbol]: set the initla symbol for the tapeset_tape [start] [string]: putstringon the tape starting fromstartset_state [state]: set the state tostatemove_head [pos]: move the head to posadd (+) [from] [read] [to] [write] [dir]: add a new instruction. Fromfromif you readreadgo toto, writewriteand move the head todir.diris<for left and>for right.del (-) [n]: deletes the instruction number `n``print_program (pp): print the programprint_state (ps): print the machine stateprint_state_full (psf): print the state showing the whole tapeclear (C): clears the programreset (R): reset the machineecho [string]: printsstringquit (q): quithelp (?): show help message
In GUI mode, you can:
- move tape with left/right arrow keys
- move head with
<and> - scroll program with up/down arrow keys
- run with
r - step with
s - enter command mode
: - reset machine with `R``
\change tape symbol