Turing machines implementation from contest

Job ID: 39271284

Budget: $30 – $250 USD

Your task is to solve all 10 exercises of the attached contest. The contest is already over, but I'm interested in how possible solutions for it look like.

You have to use this Turing machine simulator for it:
https://github.com/FrankBuss/turingmachine

You can compile it with Rust from scratch, or use the pre-compiled release for it, see the release 0.1 for it, for Linux, Windows and Mac.

Here is the first exercise solved:
{
"initial": "H",
"blank": "#",
"tape": "H",
"transitions": [
["H", "H", "H", "R", "T"],
["H", "T", "T", "R", "H"],
["T", "#", "T", "L", "HALT"],
["H", "#", "H", "L", "HALT"]
]
}

If you run it from the command line, you can see the output as shown in the attached screenshot. The initial tape is "H" and the final tape is "HT". If you change the "tape" in the json file to "T", then the final tape will be "TH", as required by the exercise.

Delivery will be 9 json files for the remaining 9 exercises. I'll test it with different input tape configurations and it must produce the required final tape as described in the exercises.

There is also a web version of the Turing machine simulator here, which runs without installing anything:
https://frank-buss.de/TuringMachine/
Attached is another screenshot which shows the first exercise. But it might not work for bigger machines depending on the number of steps, you have to use the command line program in this case.

Alternatively you can use this Turing machine simulator, which might be easier to use:

https://github.com/FrankBuss/turing-machine-language

The solutions for exercise 1 with the OCaml simulator looks like this:

H, T
if (H) {
right
write T
} else {
right
write H
}

After compiling the OCaml project, you can run it like this:

$ ./run.sh 1.tmsl h.tape out.tape
Input tape:
H
Output tape:
H T
Done - have a nice day. Thank you for using the run script(tm).

with the file "h.tape" just containing a single letter "H", and 1.tmsl the file listed above.

Since the original contest was conducted in only 3 hours, this should be a fairly simple project and easy to finish.
Related categories: Algorithm Computer Science