Skip to content

guofei9987/python-maze

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-maze

Generate a maze using Python

Download this repository, then use maze.py as below:

import matplotlib.pyplot as plt
import numpy as np


from maze import Maze
maze=np.zeros(shape=(100,100))
start_point=np.array([0,0])
maze_generator=Maze(maze, start_point)
plt.imshow(maze_generator.maze)

maze

Generate a maze with a picture using Python

import cv2
pic = cv2.imread('duck.jfif')
pic = cv2.cvtColor(pic, cv2.COLOR_BGR2GRAY)
pic = cv2.resize(pic, (100, 100))
pic = (pic > pic.mean()) * (-1)

from maze import Maze

start_point=np.array([50,50])
maze_generator=Maze(pic, start_point)
plt.imshow(maze_generator.maze)

duck_maze

If you want to know why it works, see here

Go and try other pictures heart_maze

About

Generate a maze using Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages