turing-machine-utils


Nameturing-machine-utils JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/porfanid/TuringMachine
SummaryCalculate the result of a turing machine on a given tape
upload_time2023-12-30 17:30:26
maintainer
docs_urlNone
authorporfanid
requires_python>=3.6
licenseMIT
keywords turing machine turing machine simulator python automata simulation computational theory state machine algorithm artificial intelligence machine learning computational science programming open source education computer science formal languages computational models tape states transition rules simulation tool complexity symbol universal turing machine computer engineering software development
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
## Table of Contents

- [Introduction](#introduction)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Configuration](#configuration)
- [Contributing](#contributing)
- [License](#license)

## Introduction

Run any Turing machine possible using this function and see if the turing machine, accepts or rejects the tape you input to it.

## Installation

```bash
pip install turing-machine-utils
```

## Usage

```python
from turing_machine_utils import create_turing_machine

# Define Turing Machine states, alphabet, and transition rules
states = ['q0', 'q1', 'accept', 'discard']
transition_rules = {
    ('q0', '0'): ('q1', '1', 'R'),
    ('q0', '1'): ('q0', '0', 'R'),
    ('q1', '0'): ('accept', '0', 'L'),
    ('q1', '1'): ('discard', '1', 'L'),
}

# Define the input tape
tape = ['0', '1', '0', '1', '0']

# Run the Turing Machine
result, new_tape, state, symbol = create_turing_machine(tape, states, transition_rules)
print("Result:", result)
```
> remember that the machine will start calculating the response from the first state. So the first element on the states list must be the beginning state

The result will be:
1. 1 if the tape is accepted by the turing machine
1. -1 if the state is discarded by the turing machine
1. 0 if an undefined transition is found by the turing machine

The new_tape is the tape with the changes to the original tape

The state and symbol are normally None. They get values that say when the turing machine reached an undefined point

## Configuration

No specific configuration options are available at the moment.

## Contributing

Feel free to contribute by reporting issues, suggesting improvements, or submitting pull requests.

## License

This project is licensed under the MIT License - see the [LICENSE](./LICENSE.md) file for details.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/porfanid/TuringMachine",
    "name": "turing-machine-utils",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "Turing Machine,Turing Machine Simulator,Python,Automata,Simulation,Computational Theory,State Machine,Algorithm,Artificial Intelligence,Machine Learning,Computational Science,Programming,Open Source,Education,Computer Science,Formal Languages,Computational Models,Tape,States,Transition Rules,Simulation Tool,Complexity,Symbol,Universal Turing Machine,Computer Engineering,Software Development",
    "author": "porfanid",
    "author_email": "pavlos@orfanidis.net.gr",
    "download_url": "https://files.pythonhosted.org/packages/88/db/4921fac79015832ee56dc1a96b52174d5cf5c4ef4d17d67e67f63ec009fe/turing_machine_utils-1.0.7.tar.gz",
    "platform": null,
    "description": "\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Configuration](#configuration)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Introduction\n\nRun any Turing machine possible using this function and see if the turing machine, accepts or rejects the tape you input to it.\n\n## Installation\n\n```bash\npip install turing-machine-utils\n```\n\n## Usage\n\n```python\nfrom turing_machine_utils import create_turing_machine\n\n# Define Turing Machine states, alphabet, and transition rules\nstates = ['q0', 'q1', 'accept', 'discard']\ntransition_rules = {\n    ('q0', '0'): ('q1', '1', 'R'),\n    ('q0', '1'): ('q0', '0', 'R'),\n    ('q1', '0'): ('accept', '0', 'L'),\n    ('q1', '1'): ('discard', '1', 'L'),\n}\n\n# Define the input tape\ntape = ['0', '1', '0', '1', '0']\n\n# Run the Turing Machine\nresult, new_tape, state, symbol = create_turing_machine(tape, states, transition_rules)\nprint(\"Result:\", result)\n```\n> remember that the machine will start calculating the response from the first state. So the first element on the states list must be the beginning state\n\nThe result will be:\n1. 1 if the tape is accepted by the turing machine\n1. -1 if the state is discarded by the turing machine\n1. 0 if an undefined transition is found by the turing machine\n\nThe new_tape is the tape with the changes to the original tape\n\nThe state and symbol are normally None. They get values that say when the turing machine reached an undefined point\n\n## Configuration\n\nNo specific configuration options are available at the moment.\n\n## Contributing\n\nFeel free to contribute by reporting issues, suggesting improvements, or submitting pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE.md) file for details.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Calculate the result of a turing machine on a given tape",
    "version": "1.0.7",
    "project_urls": {
        "Documentation": "https://github.com/porfanid/TuringMachine",
        "Funding": "https://ko-fi.com/porfanid",
        "Homepage": "https://github.com/porfanid/TuringMachine",
        "Say Thanks!": "https://saythanks.io/to/porfanid",
        "Source": "https://github.com/porfanid/TuringMachine",
        "Tracker": "https://github.com/porfanid/TuringMachine/issues"
    },
    "split_keywords": [
        "turing machine",
        "turing machine simulator",
        "python",
        "automata",
        "simulation",
        "computational theory",
        "state machine",
        "algorithm",
        "artificial intelligence",
        "machine learning",
        "computational science",
        "programming",
        "open source",
        "education",
        "computer science",
        "formal languages",
        "computational models",
        "tape",
        "states",
        "transition rules",
        "simulation tool",
        "complexity",
        "symbol",
        "universal turing machine",
        "computer engineering",
        "software development"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91c009545625b7e0302eb515fb622a24687ddf9cd20c1ffd3e79c72bb7cf862e",
                "md5": "e02b5c5ca3e316b7d98bd728d3c2dd93",
                "sha256": "ba73277a4ec836f4d3c7b777547bd7da721445c43ae257afa72c99f0094c217d"
            },
            "downloads": -1,
            "filename": "turing_machine_utils-1.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e02b5c5ca3e316b7d98bd728d3c2dd93",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4015,
            "upload_time": "2023-12-30T17:30:24",
            "upload_time_iso_8601": "2023-12-30T17:30:24.553046Z",
            "url": "https://files.pythonhosted.org/packages/91/c0/09545625b7e0302eb515fb622a24687ddf9cd20c1ffd3e79c72bb7cf862e/turing_machine_utils-1.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "88db4921fac79015832ee56dc1a96b52174d5cf5c4ef4d17d67e67f63ec009fe",
                "md5": "955ae0615c1db0a60fc75151656b5bfd",
                "sha256": "db56a2bd52ecd12b6156ffa5917f5894921ea2e3294ddfe13a4d0bbd51277e41"
            },
            "downloads": -1,
            "filename": "turing_machine_utils-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "955ae0615c1db0a60fc75151656b5bfd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3782,
            "upload_time": "2023-12-30T17:30:26",
            "upload_time_iso_8601": "2023-12-30T17:30:26.093395Z",
            "url": "https://files.pythonhosted.org/packages/88/db/4921fac79015832ee56dc1a96b52174d5cf5c4ef4d17d67e67f63ec009fe/turing_machine_utils-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-30 17:30:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "porfanid",
    "github_project": "TuringMachine",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "turing-machine-utils"
}
        
Elapsed time: 0.28404s