用于mazepy的setuptools setup.py。
mazep的Python项目详细描述
python的迷宫类。从jamis buck(https://pragprog.com/book/jbmaze/mazes-for-programmers)的《程序员的迷宫》一书中的ruby源代码翻译而来。
包括上述书籍中没有的附加代码。
要求
Python3。
安装
安装最新版本:pip Install mazepy
用法
与其他类似程序一起使用:
from mazepy import mazepy grid=mazepy.Grid(10,20) grid=mazepy.getRandomMaze(grid) print("%s Maze:" % grid.algorithm) print(grid)
上述程序的输出类似于:
Recursive Backtracker Maze: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | | | | | | | + + + +---+---+ + + +---+---+---+ +---+ + + +---+---+ + + | | | | | | | | | | | | + +---+ +---+---+---+---+ + + +---+---+ +---+ +---+ +---+---+ + | | | | | | | | | | | + + +---+ + + + +---+---+---+---+ +---+ +---+ +---+---+ +---+ | | | | | | | | | | | | + +---+ + + + +---+---+ + +---+---+ + + +---+---+ + + + | | | | | | | | | | | | | | | + + + + +---+ +---+ + + + + +---+ +---+---+ + + + + | | | | | | | | | | | | | | | | | + + +---+---+ + + +---+ + + +---+ +---+ + +---+ +---+ + | | | | | | | | | | | + +---+---+ +---+---+ + +---+ + + +---+---+ +---+ +---+---+ + | | | | | | | | | | | +---+---+ +---+ + +---+---+ +---+ +---+---+ + + + + + +---+ | | | | | | | | | | | | | + +---+ + +---+ +---+---+ + +---+ + +---+---+ + +---+---+ + | | | | | | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
另请参见:mazingame(https://github.com/samisalkosuo/mazingame)
许可证
我自己代码的麻省理工执照。
原始Ruby代码:
#--- # Excerpted from "Mazes for Programmers", # published by The Pragmatic Bookshelf. # Copyrights apply to this code. It may not be used to create training material, # courses, books, articles, and the like. Contact us if you are in doubt. # We make no guarantees that this code is fit for any purpose. # Visit http://www.pragmaticprogrammer.com/titles/jbmaze for more book information. #---