How to create maze walls in NetLogo?

时光怂恿深爱的人放手 提交于 2019-12-06 12:54:44

To highlight the edge of a patch, you'll need to use a turtle. Make a turtle shape that just consists of a line, then create a turtle with that shape and position it accordingly. You'll probably want to use a separate breed of turtles (call them "walls", say).

Once you've created the turtle, you can either keep it around if you want to do something with it later, or you can have it do "stamp die" to kill it but first have it leave an image of itself behind in the drawing.

Try looking at the code in this maze-maker netlogo model. The basic idea for the algorithm is to use a random walker that builds walls (path) as he walks. When he reaches a dead end he is teleported to a previous place where he took a turn.

Have fun! There is, of course a wikipedia entry on maze generation algorithms if you want to delve deeper.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!