[🇧🇷] Lê em português
A simple and extensible Turing Machine simulator written in Python, designed for learning, experimentation, and educational purposes.
Install directly from the Python Package Index (PyPI):
pip install turing-pyA 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
Install using pip:
pip install turing-pyOr install from source:
git clone https://github.com/ericshantos/turing-py.git
cd turing-py
pip install .- 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
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
Examples you can implement using turing-py:
- Binary increment machine
- Palindrome checker
- Unary addition
- Even/Odd binary checker
- String copying machine
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 leftR→ Move right
Contributions are welcome!
To contribute:
- Fork the repository
- Create a new branch
git checkout -b feature/my-feature- Make your changes
- Commit your work
git commit -m "Add new feature"- Push to your fork
git push origin feature/my-feature- Open a Pull Request
This project is licensed under the MIT License.
Developed by Eric Santos.