Anonymous user
Maze generation: Difference between revisions
m
→{{header|Erlang}}: Removed unnecessary "out" templates
m (→{{header|Erlang}}: Removed unnecessary "out" templates) |
|||
Line 1,869:
Erlang is single assignment. To get mutability I use processes. The code is over-enginered for this task, but the extra is used for [[Maze_solving]]. Also, Erlang starts counting at 1, not 0, so the co-ordinate of the lower left corner is 1,1.
<lang Erlang>
-module( maze ).
Line 2,038:
</pre>
Uses 2 diagraph "objects": a) the 'matrix', a fully connected digraph of MxN vertices and b) the 'maze', an unconnected digraph, also MxN, that is populated while walking.
Employs a faux Visitor pattern to populate the maze while traversing the matrix in depth-first order.
|