Perfectly random sampling (2): Wilson's uniform spanning tree algorithm

Example:

Requiremens: python>=2.7 and tqdm for showing process bar.

Usage

Run any of the example*.py scripts and wait for a few seconds, you will see a .gif file generated in current directory, enjoy it!

This program is written in pure python: no third-party modules nor softwares are needed, just built-in modules like struct, random, colorsys and some built-in functions (if you want to embed the animation into a background image then PIL is required). It can make animations of all kinds of maze generation and maze solving algorithms on the 2D grid. It runs very fast and generates optimized GIF files in only a few seconds. I could write it faster by using numpy arrays but I prefer to keep the code being "pure blooded".

Update: I have added the process bar feature in the latest version for which the tqdm lib is required.

当前网速较慢或者你使用的浏览器不支持博客特定功能,请尝试刷新或换用Chrome、Firefox等现代浏览器