Anonymous user
Maze generation: Difference between revisions
m
→{{header|Erlang}}: Shortened section titles, fixed typos + added whitespace
m (→{{header|Erlang}}: Removed unnecessary "out" templates) |
m (→{{header|Erlang}}: Shortened section titles, fixed typos + added whitespace) |
||
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>
===Using 2 digraphs===
Uses 2
Employs a faux Visitor pattern to populate the maze while traversing the matrix in depth-first order.
Vertices: 0 .. MxN - 1
Rows: 0 .. M - 1
Cols: 0 .. N - 1
Usage: start with generate_default/0. Use generate_MxN() to test other maze sizes.
<lang Erlang>
|