开发者

Depth-first search maze generation in PHP

开发者 https://www.devze.com 2023-03-03 20:06 出处:网络
I\'m looking for a very simple implementation of the Depth-first search random maze generation algorithm. I\'m trying to get my head around it, but i just can\'t understand the neighbor identification

I'm looking for a very simple implementation of the Depth-first search random maze generation algorithm. I'm trying to get my head around it, but i just can't understand the neighbor identification part.

http://en.wikipedia.org/wiki/Maze_generation_algorithm#Depth-first_search

开发者_如何学运维

Maybe someone can provide a simple snippet? :)


What do you mean, "the neighbor identification part"? If you're at (x,y), the neighbors are (x-1,y), (x,y-1), (x+1,y) and (x,y+1).


You want to randomly select an edge (Wall) from a vertex. Each vertex has 4 edges (North, South, West, East). First off you want to build a tree with all vertex IMO in Zig-Zag order?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号