From 877572918d3b0461dd943d588636a36f46701cc6 Mon Sep 17 00:00:00 2001 From: oskarmeyenburg Date: Mon, 15 Jan 2024 20:20:34 +0100 Subject: [PATCH] Cleanup --- README.md | 8 ++++- dist/mazeforge-0.1.0-py3-none-any.whl | Bin 4409 -> 4760 bytes dist/mazeforge-0.1.0.tar.gz | Bin 3819 -> 4303 bytes pyproject.toml | 49 +++++++++++++------------- src/mazeforge.egg-info/PKG-INFO | 10 ++++-- src/mazeforge/generator.py | 20 +++++------ 6 files changed, 47 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 69b153a..f3e771d 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,17 @@ # MazeForge + Generation of mazes in Python ## Installation + You can install **MazeForge** from [PyPI](https://pypi.org/project/mazeforge/) by running the following in your terminal.
`python -m pip install mazeforge`
+ MazeForge is supported on Python 3.7 and above. ## How to use + ```python >>> import mazeforge >>> mazeforge.generate(3, 3) @@ -21,5 +25,7 @@ array([[1., 1., 1., 1., 1., 1., 1.], ``` ## Documentation + ### mazeforge.generate -`mazeforge.generate` generates a perfect maze. This means that any two cells are connected by one single unique path. The function returns 2d numpy array. Walls are represented as a `1` and corridor as a `0`. The maze is generated using the prim's algorithm. \ No newline at end of file + +`mazeforge.generate` generates a perfect maze. This means that any two cells are connected by one single unique path. The function returns 2d numpy array. Walls are represented as a `1` and corridor as a `0`. The maze is generated using the prim's algorithm. diff --git a/dist/mazeforge-0.1.0-py3-none-any.whl b/dist/mazeforge-0.1.0-py3-none-any.whl index 6e7a1bdfb292e9e2b8159d8de810e76980c64d8a..c21f35ebd200fb8e78095961caf0cc34b4b4e006 100644 GIT binary patch delta 3450 zcmZvfcTf|`7REyhy$GQRQX_(d1OWjFg7nZ5iZnqW(xg|ZV(6DhQ=$k$Xi}6SO#}i_ zLXaXLP3aw!UZh^CkL$cQ_uYAK|JmKM`|a#}d*;k<8${AC^BL(=QG);g039IoA6Uw^$DDx4qbCO^Ou3(hiPx^q_2mBqtUvU#!u z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;>u+y5f|^Zo4q`{F+}RaHwh@fPsh?SF|)rv-HH6u)}?e_8yeTC0iQe-r*6A^-R7 z|Kajq_viCcP@HI&At@e1v~fu$rV{y_y1KZ;{4~m zK>R|p^t-<#ed$|0UW;t~IDl;5Hb@@vD3ixIZW~H+pxk0;8ulmuAzUz+yv5LU;Jx)h zy!ceRhj0SN9h&ThnSX6L2>mbgztH~z{-5;!eWG?}`d{AA|EgRr3H`qh5KCRW{|o&u z^uN&mLjOOY|JPricKZG=SF3CKzf`J;_y4`X<=C-($7I9gnDpf%(zl$DF64vI|3d!@ z{V(9T=>KK6=wDj@59xnc?rZvAQLAGA?_MDK)I0ncpy>B}2;Y1Ji8{N1B-~C!qWwaI zZwMl|dW5VH`d{dOq5lQ^$ol`QLY|Ml|0^5%zoLlW|J(2Ui#0DmfB*pk1PBly hK!5-N0t5&UAV7cs0RjXF5b#65{{Tkpw2c7B003)%!c+hN diff --git a/pyproject.toml b/pyproject.toml index 5df6a05..2105f80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,16 @@ [build-system] -requires = ["setuptools>=61.0.0", "wheel"] +requires = ["setuptools >= 61.0.0", "wheel"] build-backend = "setuptools.build_meta" [project] name = "mazeforge" version = "0.1.0" -description = "Simple and fast generation of mazes in Python" +description = "Simple and fast generation of mazes" readme = "README.md" authors = [{ name = "Oskar Meyenburg", email = "oskar.meyenburg@gmail.com" }] license = { file = "LICENSE" } classifiers = [ + "Intended Audience :: Developers", "Operating System :: OS Independent", "License :: OSI Approved :: MIT License", "Programming Language :: Python", @@ -19,38 +20,36 @@ keywords = ["labyrinth", "maze", "pymaze", "generation", "generate", "solve"] dependencies = ["numpy"] requires-python = ">=3.7" - [project.optional-dependencies] - build = ["build", "twine"] - dev = ["black", "bumpver", "isort", "mypy", "pytest"] +[project.optional-dependencies] +build = ["build", "twine"] +dev = ["black", "bumpver", "isort", "mypy", "pytest"] - # This would create the terminal command "mazeforge" - #[project.scripts] - #mazeforge = "mazeforge.__main__:main" +# This would create the terminal command "mazeforge" +#[project.scripts] +#mazeforge = "mazeforge.__main__:main" - [project.urls] - Homepage = "https://github.com/oskarmeyenburg/mazeforge" - repository = "https://github.com/oskarmeyenburg/mazeforge" - documentation = "https://github.com/oskarmeyenburg/mazeforge/blob/main/README.md" +[project.urls] +repository = "https://github.com/oskarmeyenburg/mazeforge" +documentation = "https://github.com/oskarmeyenburg/mazeforge/blob/main/README.md" [tool.bumpver] current_version = "0.1.0" version_pattern = "MAJOR.MINOR.PATCH" commit_message = "bump version {old_version} -> {new_version}" -commit = true -tag = true -push = false - - [tool.bumpver.file_patterns] - "pyproject.toml" = [ - 'current_version = "{version}"', - 'version = "{version}"', - ] - "src/mazeforge/__init__.py" = ["{version}"] - "src/mazeforge/__main__.py" = ["- mazeforge v{version}"] +commit = true +tag = true +push = false + +[tool.bumpver.file_patterns] +"pyproject.toml" = [ + 'current_version = "{version}"', + 'version = "{version}"', +] +"src/mazeforge/__init__.py" = ["{version}"] [tool.isort] -profile = "black" -import_heading_stdlib = "Standard library imports" +profile = "black" +import_heading_stdlib = "Standard library imports" import_heading_thirdparty = "Third party imports" import_heading_firstparty = "Reader imports" diff --git a/src/mazeforge.egg-info/PKG-INFO b/src/mazeforge.egg-info/PKG-INFO index d0bfbe0..683b322 100644 --- a/src/mazeforge.egg-info/PKG-INFO +++ b/src/mazeforge.egg-info/PKG-INFO @@ -1,7 +1,7 @@ Metadata-Version: 2.1 Name: mazeforge Version: 0.1.0 -Summary: Simple and fast generation of mazes in Python +Summary: Simple and fast generation of mazes Author-email: Oskar Meyenburg License: MIT License @@ -25,10 +25,10 @@ License: MIT License OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Project-URL: Homepage, https://github.com/oskarmeyenburg/mazeforge Project-URL: repository, https://github.com/oskarmeyenburg/mazeforge Project-URL: documentation, https://github.com/oskarmeyenburg/mazeforge/blob/main/README.md Keywords: labyrinth,maze,pymaze,generation,generate,solve +Classifier: Intended Audience :: Developers Classifier: Operating System :: OS Independent Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python @@ -48,15 +48,19 @@ Requires-Dist: mypy; extra == "dev" Requires-Dist: pytest; extra == "dev" # MazeForge + Generation of mazes in Python ## Installation + You can install **MazeForge** from [PyPI](https://pypi.org/project/mazeforge/) by running the following in your terminal.
`python -m pip install mazeforge`
+ MazeForge is supported on Python 3.7 and above. ## How to use + ```python >>> import mazeforge >>> mazeforge.generate(3, 3) @@ -70,5 +74,7 @@ array([[1., 1., 1., 1., 1., 1., 1.], ``` ## Documentation + ### mazeforge.generate + `mazeforge.generate` generates a perfect maze. This means that any two cells are connected by one single unique path. The function returns 2d numpy array. Walls are represented as a `1` and corridor as a `0`. The maze is generated using the prim's algorithm. diff --git a/src/mazeforge/generator.py b/src/mazeforge/generator.py index 5889b5d..524e2da 100644 --- a/src/mazeforge/generator.py +++ b/src/mazeforge/generator.py @@ -1,7 +1,7 @@ import random import numpy -def generate(width: int, height: int) -> numpy.ndarray: +def generate(width, height): """ Generate a 2d maze on a grid. @@ -17,27 +17,23 @@ def generate(width: int, height: int) -> numpy.ndarray: numpy.ndarray Maze as a numpy.ndarray with the shape (2 * width + 1, 2 * height + 1) """ - width = width * 2 + 1 - height = height * 2 + 1 - maze = numpy.ones((width, height), dtype=numpy.int_) + # Prim's algorithm + array_width = width * 2 + 1 + array_height = height * 2 + 1 + maze = numpy.ones((array_width, array_height), dtype=numpy.int_) - for x, y in numpy.ndindex((width, height)): + for x, y in numpy.ndindex((array_width, array_height)): if 1 == x % 2 == y % 2: maze[x, y] = 0 - # Prim's algorithm - maze_width = (width - 1) // 2 - maze_height = (height - 1) // 2 - def get_neighbours(x, y): neighbours = {(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1)} for neighbour in tuple(neighbours): - if not (0 <= neighbour[0] < maze_width and 0 <= neighbour[1] < maze_height): + if not (0 <= neighbour[0] < width and 0 <= neighbour[1] < height): neighbours.discard(neighbour) return neighbours - - existing_cells = {(maze_width // 2, maze_height // 2)} + existing_cells = {(width // 2, height // 2)} adjacent_cells = get_neighbours(*list(existing_cells)[0]) while len(adjacent_cells):