Maze generation: Difference between revisions
Content added Content deleted
Line 6,725: | Line 6,725: | ||
newneighbour: function [pos][ |
newneighbour: function [pos][ |
||
nnbs: collect [ |
nnbs: collect [ |
||
if all [pos/x > 0 not visited? |
if all [pos/x > 0 not visited? p: pos - 1x0] [keep p] |
||
if all [pos/x < (size/x - 1) not visited? |
if all [pos/x < (size/x - 1) not visited? p: pos + 1x0] [keep p] |
||
if all [pos/y > 0 not visited? |
if all [pos/y > 0 not visited? p: pos - 0x1] [keep p] |
||
if all [pos/y < (size/y - 1) not visited? |
if all [pos/y < (size/y - 1) not visited? p: pos + 0x1] [keep p] |
||
] |
] |
||
pick nnbs random length? nnbs |
pick nnbs random length? nnbs |