http://www.ffconsultancy.com/ocaml/maze/
it is now 30% shorter and much faster, using an array instead of a functional
map. It also uses continuation passing style instead of an explicit stack.
But it no longer produces PostScript output.
The program uses a simple depth first search. An interesting alternative
algorithm involves keeping track of sets of connection cells and breaking
walls to unify the sets until you have a spanning tree. That should be easy
to code in OCaml but I think it will generate mazes that are much harder to
solve.
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs