Skip to content

tucna/TuringMachine

Repository files navigation

Turing machine

Program to process and visualize Turing machine.

The project is built on tPixelGameEngine and Dear ImGui for debug purposes. The debug window shows all delta functions.

Controls

  • Space - step.
  • F1 - debug window.

Features

Simulation supports step by step program processing fetched via JSON files. You can see visualization of tape, head and transition function behavior.

Data input

Program (δ functions and specifications) are fetched from JSON as demonstrated bellow.

{
    "function": "Addition of binary numbers.",
    "states": ["0", "1", "2", "3", "4", "5", "H"],
    "start_state": "0",
    "delta": [
        [["0", "0"], ["0", "0", "R"]],
        [["0", "1"], ["0", "1", "R"]],
        [["0", "_"], ["1", "_", "R"]],
        [["1", "0"], ["1", "0", "R"]],
        [["1", "1"], ["1", "1", "R"]],
        [["1", "_"], ["2", "_", "L"]],
        [["2", "0"], ["2", "1", "L"]],
        [["2", "1"], ["3", "0", "L"]],
        [["2", "_"], ["5", "_", "R"]],
        [["3", "0"], ["3", "0", "L"]],
        [["3", "1"], ["3", "1", "L"]],
        [["3", "_"], ["4", "_", "L"]],
        [["4", "0"], ["0", "1", "R"]],
        [["4", "1"], ["4", "0", "L"]],
        [["4", "_"], ["0", "1", "R"]],
        [["5", "1"], ["5", "_", "R"]],
        [["5", "_"], ["H", "_", "L"]]
    ]
}

User must specify function name, states, starting state and the functions. Data are fetched from another JSON which looks as follows.

{
    "start_cell": 5,
    "data": ["1", "0", "1", "_", "0", "1", "1", "0"]
}

Starting cell on the tape must be specified together with the data.

Screenshots

   

About

Turing machine visualization in C++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published