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? p1: pos - 1x0] [keep p1]
if all [pos/x > 0 not visited? p: pos - 1x0] [keep p]
if all [pos/x < (size/x - 1) not visited? p2: pos + 1x0] [keep p2]
if all [pos/x < (size/x - 1) not visited? p: pos + 1x0] [keep p]
if all [pos/y > 0 not visited? p3: pos - 0x1] [keep p3]
if all [pos/y > 0 not visited? p: pos - 0x1] [keep p]
if all [pos/y < (size/y - 1) not visited? p4: pos + 0x1] [keep p4]
if all [pos/y < (size/y - 1) not visited? p: pos + 0x1] [keep p]
]
]
pick nnbs random length? nnbs
pick nnbs random length? nnbs