Skip to content

Universal Turing machine (UTM) is a Turing machine that can simulate an arbitrary Turing machine on arbitrary input

License

Notifications You must be signed in to change notification settings

MailsonRuas/Universal-Turing-Machine-UTM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Universal Turing Machine

This project implements a Universal Turing Machine in the C programming language. A Turing Machine is a mathematical model of computation that defines an abstract machine, which manipulates symbols on a strip of tape according to a set of rules. The universal version of this machine can simulate any other Turing machine.

Reserved Symbols

  • >: Move the tape head to the right.
  • <: Move the tape head to the left.
  • #: Initial symbol on the tape.
  • _: Blank space on the tape.

How to Use

  1. Compile the Program: Use a C compiler to compile the code. For example, using GCC:
gcc turing_machine.c -o turing_machine
  1. Run the Program: Execute the compiled program:
./turing_machine
  1. Input the Transitions: Follow the prompts to input the transitions, initial state, and final states.
  2. Input the String: Enter the string to be processed by the Turing machine and the initial position of the tape head.
  3. Simulation: The program will simulate the Turing machine's operation and indicate whether the input string is accepted or not.

Examples

  1. Example 1:

    • Transitions:
      1,a,2,b,>
      2,b,1,a,<
    • Initial State: 1
    • Final State(s): 2
    • Input String: abab
    • Initial Head Position: 0
    • Result: Accepted
  2. Example 2:

    • Transitions:
      1,a,1,a,>
      1,_,2,_,<
    • Initial State: 1
    • Final State(s): 2
    • Input String: aaa
    • Initial Head Position: 0

notes

  • Ensure the input format for transitions follows the state1,symbol1,state2,symbol2,direction pattern.
  • The program can be modified to handle more complex Turing machines with additional features as needed.

About

Universal Turing machine (UTM) is a Turing machine that can simulate an arbitrary Turing machine on arbitrary input

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages