Skip to content

Implementation of different Maze Generation algorithms in Haskell

License

Notifications You must be signed in to change notification settings

Average-user/MazeGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haskell Maze Generator

This software provides an implementation of several algorithms to generate mazes. The mazes are shown with Gloss (2D vector graphics, package for Haskell). It also allows to draw paths from one place to another, and is capable of generating perfect and non-perfect mazes. This project is strongly inspired by this blog of Maze Generation algorithms

Algorithms implemented so far

Usage

The parameters for building the maze, are specified in config.json file. Which by default is:

{
    "algorithm": "Prims",
    "maze-size": "(30,30)",
    "walls-to-remove": "10",
    "draw-paths": "True",
    "path-starting-point": "(0,0)",
    "path-ending-point": "(29, 29)"
}

To know by what name algorithms are recognized checkout ParseConfig.hs.

walls-to-remove refers to the amount of walls to remove from the maze to make a non-perfect maze. The default 0, generates perfect mazes (one and only one path from any place to another).

When draw-paths is on, it I'll draw shortest paths in red, and the more large ones in purple.

An example of default config.json:

stack build
stack exec MazeGen-exe

Test And Benchmarks

You can run some random tests using QuickCheck with:

stack test

And benchmarks using criterion with:

stack bench

Although is recommended to use

stack bench --ba='-o bench.html'

To output benchmarks results in an .html file. That looks like:

Let us say that this benchmarks will always run with the same Random Gen. This means that every time you run it, it'll measure the time of the same process, that will not be affected by randomness, but only by changes to the algorithms. The Random Gen chosen is completely arbitrary.

About

Implementation of different Maze Generation algorithms in Haskell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published