This little program generates Cretan Labyrinths. The various parameters allow to generate one of the two possible labyrinth, with various styles (round, square, spiky...). It is also possible to create an animation showing how to draw the labyrinth. More info in this blog post.
First install haskell platform and the HEAD of diagrams.
git clone [email protected]:cdupont/CretanMaze.git
cd CretanMaze
ghc --make maze.hs -o maze
Usage: maze [-w|--width WIDTH] [-h|--height HEIGHT] [-o|--output OUTPUT] [-l|--loop] [-s|--src ARG] [-i|--interval INTERVAL] [-f|--fpu ARG] [-j|--join <Miter|Round|Bevel>] [-c|--cap <Round|Square|SquareCut>] [-d|--seed <Round|Square|SquareCut>] [-p|--seedPos <0|1>] [-a|--animation]
Available options:
-?,--help Show this help text
-w,--width WIDTH Desired WIDTH of the output image
-h,--height HEIGHT Desired HEIGHT of the output image
-o,--output OUTPUT OUTPUT file
-l,--loop Run in a self-recompiling loop
-s,--src ARG Source file to watch
-i,--interval INTERVAL When running in a loop, check for changes every INTERVAL seconds.
-f,--fpu ARG Frames per unit time (for animations)
-j,--join <Miter|Round|Bevel> Style of the joins (choose one)
-c,--cap <Round|Square|SquareCut> Style of the caps (choose one)
-d,--seed <Round|Square|SquareCut> Style of the seed (choose one)
-p,--seedPos <0|1> Position of the seed (0 or 1)
-a,--animation generate an animation
The options j, c and d are used to control the style of the joins (how to link two segment of line), caps (how to link a segment of line and a point) and the seed. The option p is used to choose one of the two possible placement for the seed.
Here are some examples of generation:
./maze -w 400 -o maze.svg
./maze -w 400 -o maze.svg -p 1
./maze -w 400 -o maze.svg -d Square -j Miter -c Square -p 1
./maze -w 400 -o maze.svg -d SquareCut -j Miter -c SquareCut -p 1
./maze -w 400 -o maze.svg -a
convert -delay 10 -loop 0 maze*.svg maze.gif
Will create an animation: