A simple Turing machine on C that can solve tasks by input file with specific format.
- First you need to run
gcc main.c - Then you can run
./main {input file name (e.g. input1.txt)}for use the program
Input file format:
- The first line contains the input string
- The second line contains the initial and final states, respectively
- The next lines to the file's end contain the transactions of the Turing machine
Transaction line format:
{current state} {input symbol} -> {new state} {new symbol} {movement}
P.S. States that are not initial or terminal are written directly in transactions and nowhere else. _ is used as a lambda symbol.
At the end of program's work terminal contains three strings. First string contains information about program work, second string contains output (content of the strip after the end of the work), and third string contains last state and transactions count at the moment of program's finish.
Next paragraphs are about options of first line.
Program has transactions count limit equals 10000. So if it makes 10000 transactions, you get a message:
-> MADE 10000 transactions.
If it fails on some transaction, you get a message:
-> FAIL after {transactions count} transactions.
Else if program successfully finishes, you get a message:
-> STOP after {transactions count} transactions.