Code Monkey home page Code Monkey logo

universal-turing-machine-utm's Introduction

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.

universal-turing-machine-utm's People

Contributors

mailsonruas avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.