caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Maze generator
@ 2007-02-21 22:32 Jon Harrop
  0 siblings, 0 replies; only message in thread
From: Jon Harrop @ 2007-02-21 22:32 UTC (permalink / raw)
  To: caml-list


Whilst revamping our website, I took the time to improve the maze generator:

  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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-21 22:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-21 22:32 Maze generator Jon Harrop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).