This program is no longer maintained!
Please, use the newer version: https://github.com/margual56/turing-machine-2.0
It has lots of new cool features, a better syntaxis and it's written in rust!
A Turing machine interpreter made in Java using Processing libraries.
This is the Example2.tm (which duplicates the input) running in real time
- Download the latest version!
- Also, check out the extensions, which enable syntax highlighting, icons for the supported files and more:
(From version 3 onwards)
Usage: java -jar TuringMachine.jar [options]
A simple Turing Machine simulator with a GUI. It uses the syntax we use at class in Computability (EPI Gijón).
Optional arguments:
(none) Run the program normally (GUI mode)
-h, --help Show this help message and exit
--headless FILE [-v] Run in headless mode (print the result and exit, no GUI). Write `-v` to get the verbose output.
-e, --example Print an example program and exit
Note:
You can only provide one argument at a time. If more than one is provided, just the first one is going to be taken into account.
Inside the examples folder, there are 5 example programs of how to code a Turing Machine program. The extension of the files has to be .tm
.
Firstly, you define the initial state of the tape (example):
{q011101111};
After that (in this order), you define the final state:
#define F = {f};
And finally, you define all the states that you want. The syntax is the following: (state, oldValue, newValue, L/R/H (meaning "left/right/halt"), goToState);
Example:
(q0, 1, 0, R, q1);
Comments can be written using //
So a fully-working program would look like this (from Example1.tm, it adds the two input numbers):
// a + b
{q011111011};
#define F = {q2};
(q0, 1, 0, R, q1);
(q1, 1, 1, R, q1);
(q1, 0, 0, R, q2);
(q2, 1, 0, H, q2);
(q2, 0, 0, H, q2);
Go to the releases page and download the latest version. It is programmed in Java, so it is cross-platform.
When you execute it, it will prompt you to select the ".tm" file (the turing machine code) you want to execute. Select it and it will start running.
spacebar
-> pause/resume (or restart if the execution has finished)right arrow
-> Advance just one instruction forwardenter
-> Jump to the end of the executionr
-> Stop, load a new program and run itESC
-> Exit cleanly+
-> Increase speed-
-> Decrease speed=
-> Restore initial speed