Skip to main content

Education Turing Machine simulator in Python

Project description

[๐Ÿ‡ง๐Ÿ‡ท] Lรช em portuguรชs

Turing-py

A simple and extensible Turing Machine simulator written in Python, designed for learning, experimentation, and educational purposes.

PyPI Python 3.12 License: MIT

Install directly from the Python Package Index (PyPI):

pip install turing-py

๐Ÿ“š About

A Turing Machine is an abstract computational model introduced by Alan Turing in 1936. It is widely used in computer science to study the limits of computation and algorithm design.

turing-py provides a Python implementation that enables:

  • Simulation of Turing Machines
  • Creation of custom transition rules
  • Step-by-step computation
  • Experimentation with theoretical algorithms

This project is intended for:

  • Computer Science students
  • Theory of Computation courses
  • Developers interested in computational models
  • Educational demonstrations

๐Ÿ“ฆ Installation

Install using pip:

pip install turing-py

Or install from source:

git clone https://github.com/ericshantos/turing-py.git
cd turing-py
pip install .

โœจ Features

  • Deterministic Turing Machine simulation
  • Customizable tape input
  • Configurable states and transitions
  • Step-by-step execution
  • Simple and modular Python architecture
  • Easy to extend and modify
  • CLI-ready structure

๐Ÿ“‚ Project Structure

turing-py/
โ”‚
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ .gitignore
โ”‚
โ”œโ”€โ”€ src/
    โ””โ”€โ”€ tmpy/
        โ”œโ”€โ”€ __init__.py
        โ”‚
        โ”œโ”€โ”€ machine/
        โ”‚   โ”œโ”€โ”€ __init__.py
        โ”‚   โ”œโ”€โ”€ turing_machine.py
        โ”‚   โ”œโ”€โ”€ tape.py
        โ”‚   โ””โ”€โ”€ states.py
        โ”‚
        โ”œโ”€โ”€ alphabet/
        โ”‚   โ”œโ”€โ”€ __init__.py
        โ”‚   โ”œโ”€โ”€ symbol.py
        โ”‚   โ”œโ”€โ”€ alphabet.py
        โ”‚   โ””โ”€โ”€ tape_alphabet.py
        โ”‚
        โ””โ”€ transition/
            โ”œโ”€โ”€ __init__.py
            โ”œโ”€โ”€ transition.py
            โ”œโ”€โ”€ transition_function.py
            โ””โ”€โ”€ direction.py

๐Ÿงช Example Turing Machines

Examples you can implement using turing-py:

  • Binary increment machine
  • Palindrome checker
  • Unary addition
  • Even/Odd binary checker
  • String copying machine

๐Ÿงฉ How It Works

A Turing Machine consists of:

  • Tape โ€“ infinite memory divided into cells
  • Head โ€“ reads and writes symbols on the tape
  • States โ€“ machine configuration states
  • Transition Function โ€“ rules that determine the next action

Each step follows this rule:

(Current State, Read Symbol) โ†’ (Next State, Write Symbol, Move Direction)

Where direction can be:

  • L โ†’ Move left
  • R โ†’ Move right

๐Ÿค Contributing

Contributions are welcome!

To contribute:

  1. Fork the repository
  2. Create a new branch
git checkout -b feature/my-feature
  1. Make your changes
  2. Commit your work
git commit -m "Add new feature"
  1. Push to your fork
git push origin feature/my-feature
  1. Open a Pull Request

๐Ÿ“œ License

This project is licensed under the MIT License.


๐Ÿ‘จโ€๐Ÿ’ป Author

Developed by Eric Santos.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

turing_py-2.3.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

turing_py-2.3.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file turing_py-2.3.1.tar.gz.

File metadata

  • Download URL: turing_py-2.3.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for turing_py-2.3.1.tar.gz
Algorithm Hash digest
SHA256 958e6cae212d6aacb7e2d21bb70b6e940dcc84032bee782f24f38dfaa9c293b0
MD5 d77ca14bd73beeb4cdd0ac43b77c5611
BLAKE2b-256 1d75b59ebe77a9b8c27e3e5a83a048da8cb602ba1487609a7fa58a032f2cda32

See more details on using hashes here.

Provenance

The following attestation bundles were made for turing_py-2.3.1.tar.gz:

Publisher: python-publish.yml on ericshantos/turing-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file turing_py-2.3.1-py3-none-any.whl.

File metadata

  • Download URL: turing_py-2.3.1-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for turing_py-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f117d66b79ddffa8d03002201469b6fd18725462250c00965abbfb484033bf0f
MD5 5f81dff0a5a47ed42bc38bf1881fe57c
BLAKE2b-256 2e9c5b64615e95e82ca96f30996c7d589a4d4eb8ce01e7d403a224ef2d5437e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for turing_py-2.3.1-py3-none-any.whl:

Publisher: python-publish.yml on ericshantos/turing-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page