Skip to content

Commit

Permalink
Added workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
omeyenburg committed Jan 15, 2024
1 parent a2318a4 commit a657ec6
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 27 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and Test

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy
- name: Run tests
run: pytest
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mazeforge.egg-info
**/__pycache__
**/.DS_Store
**/.vscode
tutorial.md
venv
72 changes: 72 additions & 0 deletions src/mazeforge.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Metadata-Version: 2.1
Name: mazeforge
Version: 0.1.0
Summary: Simple and fast generation of mazes in Python
Author-email: Oskar Meyenburg <[email protected]>
License: MIT License

Copyright (c) 2024 Oskar Meyenburg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Provides-Extra: build
Requires-Dist: build; extra == "build"
Requires-Dist: twine; extra == "build"
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: bumpver; extra == "dev"
Requires-Dist: isort; extra == "dev"
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.<br>
`python -m pip install mazeforge`
<br>
MazeForge is supported on Python 3.7 and above.

## How to use
```python
>>> import mazeforge
>>> mazeforge.generate(3, 3)
array([[1., 1., 1., 1., 1., 1., 1.],
[1., 0., 1., 0., 0., 0., 1.],
[1., 0., 1., 0., 1., 1., 1.],
[1., 0., 0., 0., 1., 0., 1.],
[1., 1., 1., 0., 1., 0., 1.],
[1., 0., 0., 0., 0., 0., 1.],
[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.
13 changes: 13 additions & 0 deletions src/mazeforge.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
LICENSE
MANIFEST.in
README.md
pyproject.toml
src/mazeforge/__init__.py
src/mazeforge/generator.py
src/mazeforge.egg-info/PKG-INFO
src/mazeforge.egg-info/SOURCES.txt
src/mazeforge.egg-info/dependency_links.txt
src/mazeforge.egg-info/entry_points.txt
src/mazeforge.egg-info/requires.txt
src/mazeforge.egg-info/top_level.txt
tests/test_generator.py
1 change: 1 addition & 0 deletions src/mazeforge.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions src/mazeforge.egg-info/entry_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[console_scripts]
mazeforge = mazeforge.__main__:main
12 changes: 12 additions & 0 deletions src/mazeforge.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
numpy

[build]
build
twine

[dev]
black
bumpver
isort
mypy
pytest
1 change: 1 addition & 0 deletions src/mazeforge.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mazeforge
Binary file removed src/mazeforge/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed src/mazeforge/__pycache__/generator.cpython-311.pyc
Binary file not shown.
Empty file added tests/__init__.py
Empty file.
26 changes: 0 additions & 26 deletions tests/grid_generation.py

This file was deleted.

27 changes: 27 additions & 0 deletions tests/test_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import src.mazeforge as mazeforge
# import pygame
import numpy
import time

width = height = 4
maze = mazeforge.generate(width, height)
print(maze)
time.sleep(1)
# width = width * 2 + 1
# height = height * 2 + 1
# pygame.init()
# window = pygame.display.set_mode((width * 10, height * 10))


# for x, y in numpy.ndindex((width, height)):
# if not maze[x, y]:
# pygame.draw.rect(window, (255, 255, 255), (x * 10, y * 10, 10, 10))


# while True:
# for event in pygame.event.get():
# if event.type == pygame.QUIT:
# pygame.quit()
# raise SystemExit()

# pygame.display.flip()

0 comments on commit a657ec6

Please sign in to comment.