Maze generation: Difference between revisions
Content added Content deleted
m (Delphi small fix) |
m (Delphi small fixes of my code) |
||
Line 2,062: | Line 2,062: | ||
var |
var |
||
Maze : array[0..mwidth - 1, 0..mheight - 1] of TMCell; |
Maze : array[0..mwidth - 1, 0..mheight - 1] of TMCell; |
||
⚫ | |||
procedure PrepareMaze; |
procedure PrepareMaze; |
||
Line 2,069: | Line 2,068: | ||
d : Integer; |
d : Integer; |
||
Pool : array of TPoint; // Pool of directions to pick randomly from |
Pool : array of TPoint; // Pool of directions to pick randomly from |
||
⚫ | |||
begin |
begin |
||
Position := Point(Random(mwidth), Random(mheight)); |
Position := Point(Random(mwidth), Random(mheight)); |
||
Line 2,093: | Line 2,093: | ||
Offset(Pool[d]); |
Offset(Pool[d]); |
||
if Maze[x, y].Visited then Continue; |
|||
Maze[x, y].Visited := True; |
Maze[x, y].Visited := True; |
||
if Pool[d].y = -1 then Maze[x, y+1].PassTop := True; // comes from down to up ( ^ ) |
if Pool[d].y = -1 then Maze[x, y+1].PassTop := True; // comes from down to up ( ^ ) |
||
if Pool[d].x = 1 then Maze[x, y].PassLeft := True; // comes from left to right ( --> ) |
if Pool[d].x = 1 then Maze[x, y].PassLeft := True; // comes from left to right ( --> ) |