mazely


Namemazely JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryImplementation of maze-related algorithms
upload_time2023-07-08 10:11:17
maintainer
docs_urlNone
authorKenneth C.
requires_python>=3.11
licenseMIT
keywords mazely maze algorithms
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <img src="https://raw.githubusercontent.com/Munckenh/mazely/main/docs/images/32x128-solution.svg" alt="Solved 32x128 maze">
</p>

# mazely

[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](http://choosealicense.com/licenses/mit/)
[![Read the Docs](https://img.shields.io/readthedocs/mazely)](http://mazely.readthedocs.io/)

An API for solving and generating mazes, written in Python.

## Documentation

A library reference can be found [here](https://mazely.readthedocs.io/en/latest/).

## Usage examples

Run the Python scripts below from the repository directory.

Also, see the [examples](https://github.com/Munckenh/mazely/tree/main/examples) folder.

### Load and display a maze

Create an instance of `Maze` and pass a path to a maze file to load an existing maze. Use the `show_grid()` method from `Utilities` to display a grid of the maze.

```py
from mazely import Maze, Utilities

maze = Maze(path="resources/2015apec.maze")
utils = Utilities()
utils.show_grid(maze.grid)
```

<p align="center">
    <img src="https://raw.githubusercontent.com/Munckenh/mazely/main/docs/images/2015apec.svg" alt="APEC 2015">
</p>

### Solve a maze and display its solution

A solution is always made when you create an instance of `Maze`. To display the solution, use the `show_solution()` method from `Utilities`.

```py
from mazely import Maze, Utilities

maze = Maze(path="resources/2019japan.maze")
utils = Utilities()
utils.show_solution()
```

<p align="center">
    <img src="https://raw.githubusercontent.com/Munckenh/mazely/main/docs/images/2019japan-solution.svg" alt="Japan 2019">
</p>

### Generate a maze and display its solution

To generate a maze, pass the row and column counts as you create a `Maze` instance. Refer to the previous section to display its solution.

```py
from mazely import Maze, Utilities

maze = Maze(32, 32)
utils = Utilities()
utils.show_solution()
```

<p align="center">
    <img src="https://raw.githubusercontent.com/Munckenh/mazely/main/docs/images/32x32-solution.svg" alt="Solved 32x32 maze">
</p>

## Maze files

The library only supports a single maze format, as specified below.

### File format

Each cell is 3 characters wide and 3 characters tall.

```
+---+
|   |
+---+
```

To specify the goal cell, replace the center with `G`.

```
+---+
| G |
+---+
```

And replace with `S` for the start cell.

```
+---+
| S |
+---+
```

Here is an example of a 3x3 maze.

```
+---+---+---+
|           |
+   +---+   +
|     G |   |
+---+---+   +
| S         |
+---+---+---+
```

### Links

Here are a couple links to collections of maze files (format may not be supported):

- <https://github.com/micromouseonline/mazefiles>
- <http://www.tcp4me.com/mmr/mazes/>

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mazely",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "mazely,maze,algorithms",
    "author": "Kenneth C.",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/1d/48/89103de70ee91885293a89af9edc39fa6695cc6bdcc916773275f7b9bf94/mazely-0.1.1.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\r\n    <img src=\"https://raw.githubusercontent.com/Munckenh/mazely/main/docs/images/32x128-solution.svg\" alt=\"Solved 32x128 maze\">\r\n</p>\r\n\r\n# mazely\r\n\r\n[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](http://choosealicense.com/licenses/mit/)\r\n[![Read the Docs](https://img.shields.io/readthedocs/mazely)](http://mazely.readthedocs.io/)\r\n\r\nAn API for solving and generating mazes, written in Python.\r\n\r\n## Documentation\r\n\r\nA library reference can be found [here](https://mazely.readthedocs.io/en/latest/).\r\n\r\n## Usage examples\r\n\r\nRun the Python scripts below from the repository directory.\r\n\r\nAlso, see the [examples](https://github.com/Munckenh/mazely/tree/main/examples) folder.\r\n\r\n### Load and display a maze\r\n\r\nCreate an instance of `Maze` and pass a path to a maze file to load an existing maze. Use the `show_grid()` method from `Utilities` to display a grid of the maze.\r\n\r\n```py\r\nfrom mazely import Maze, Utilities\r\n\r\nmaze = Maze(path=\"resources/2015apec.maze\")\r\nutils = Utilities()\r\nutils.show_grid(maze.grid)\r\n```\r\n\r\n<p align=\"center\">\r\n    <img src=\"https://raw.githubusercontent.com/Munckenh/mazely/main/docs/images/2015apec.svg\" alt=\"APEC 2015\">\r\n</p>\r\n\r\n### Solve a maze and display its solution\r\n\r\nA solution is always made when you create an instance of `Maze`. To display the solution, use the `show_solution()` method from `Utilities`.\r\n\r\n```py\r\nfrom mazely import Maze, Utilities\r\n\r\nmaze = Maze(path=\"resources/2019japan.maze\")\r\nutils = Utilities()\r\nutils.show_solution()\r\n```\r\n\r\n<p align=\"center\">\r\n    <img src=\"https://raw.githubusercontent.com/Munckenh/mazely/main/docs/images/2019japan-solution.svg\" alt=\"Japan 2019\">\r\n</p>\r\n\r\n### Generate a maze and display its solution\r\n\r\nTo generate a maze, pass the row and column counts as you create a `Maze` instance. Refer to the previous section to display its solution.\r\n\r\n```py\r\nfrom mazely import Maze, Utilities\r\n\r\nmaze = Maze(32, 32)\r\nutils = Utilities()\r\nutils.show_solution()\r\n```\r\n\r\n<p align=\"center\">\r\n    <img src=\"https://raw.githubusercontent.com/Munckenh/mazely/main/docs/images/32x32-solution.svg\" alt=\"Solved 32x32 maze\">\r\n</p>\r\n\r\n## Maze files\r\n\r\nThe library only supports a single maze format, as specified below.\r\n\r\n### File format\r\n\r\nEach cell is 3 characters wide and 3 characters tall.\r\n\r\n```\r\n+---+\r\n|   |\r\n+---+\r\n```\r\n\r\nTo specify the goal cell, replace the center with `G`.\r\n\r\n```\r\n+---+\r\n| G |\r\n+---+\r\n```\r\n\r\nAnd replace with `S` for the start cell.\r\n\r\n```\r\n+---+\r\n| S |\r\n+---+\r\n```\r\n\r\nHere is an example of a 3x3 maze.\r\n\r\n```\r\n+---+---+---+\r\n|           |\r\n+   +---+   +\r\n|     G |   |\r\n+---+---+   +\r\n| S         |\r\n+---+---+---+\r\n```\r\n\r\n### Links\r\n\r\nHere are a couple links to collections of maze files (format may not be supported):\r\n\r\n- <https://github.com/micromouseonline/mazefiles>\r\n- <http://www.tcp4me.com/mmr/mazes/>\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Implementation of maze-related algorithms",
    "version": "0.1.1",
    "project_urls": {
        "Documentation": "https://mazely.readthedocs.io/en/latest/",
        "Repository": "https://github.com/Munckenh/mazely"
    },
    "split_keywords": [
        "mazely",
        "maze",
        "algorithms"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ff2a49ba80d9d044bb2cf9e2544c824b39598d279636ba77ab485e1c769fe2e5",
                "md5": "d06e087051f1b4c5d8f9ec316023f9ed",
                "sha256": "31f018df0e006a9c706319e63a29355e0b7678500eadad3ba6a565d9e2351294"
            },
            "downloads": -1,
            "filename": "mazely-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d06e087051f1b4c5d8f9ec316023f9ed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 11313,
            "upload_time": "2023-07-08T10:11:15",
            "upload_time_iso_8601": "2023-07-08T10:11:15.165198Z",
            "url": "https://files.pythonhosted.org/packages/ff/2a/49ba80d9d044bb2cf9e2544c824b39598d279636ba77ab485e1c769fe2e5/mazely-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d4889103de70ee91885293a89af9edc39fa6695cc6bdcc916773275f7b9bf94",
                "md5": "1265aaafa7287ee718d36ecb8aa0abfe",
                "sha256": "161dd97af4c07bebc55b75c3eaa507f028bd23ccef26af7b1a1055269baaaf4d"
            },
            "downloads": -1,
            "filename": "mazely-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1265aaafa7287ee718d36ecb8aa0abfe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 9786,
            "upload_time": "2023-07-08T10:11:17",
            "upload_time_iso_8601": "2023-07-08T10:11:17.121932Z",
            "url": "https://files.pythonhosted.org/packages/1d/48/89103de70ee91885293a89af9edc39fa6695cc6bdcc916773275f7b9bf94/mazely-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-08 10:11:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Munckenh",
    "github_project": "mazely",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "mazely"
}
        
Elapsed time: 0.08683s