Git Product home page Git Product logo

mazegenerator's Introduction

Maze generator

Generate mazes of different shapes and arbitrary sizes Maze types

Maze generator can create rectangular, hexagonal, honeycomb and circular mazes. Maze generation can be done using Kruskal's algorithm, depth-first search, breadth-first search, loop-erased random walk or Prim's algorithm. Mazes can be rendered in svg or png format (using gnuplot as intermediate in the latter case).

Dependencies

Maze generator uses gnuplot (with a system call gnuplot) to render png mazes. So make sure that gnuplot 5.0+ is installed with pngcairo terminal support and is in the path if you wish to use png.

The code is written in C++ 11, you will need a not-too-ancient C++ compiler to build it.

Installation

cd src; make

Usage

Usage: mazegen [--help] [-m <maze type>] [-a <algorithm type>]
               [-s <size> | -w <width> -h <height>]
               [-t <output type] [-o <output prefix>]

Optional arguments
  --help  Show this message and exit
  -m      Maze type
          0: Rectangular (default)
          1: Hexagonal (triangular lattice)
          2: Honeycomb
          3: Circular
          4: Circular (triangular lattice)
          5: User-defined
  -a      Algorithm type
          0: Kruskal's algorithm (default)
          1: Depth-first search
          2: Breadth-first search
          3: Loop-erased random walk
          4: Prim's algorithm
  -s      Size (non-rectangular mazes, default: 20)
  -w,-h   Width and height (rectangular maze, default: 20)
  -t      Output type
          0: svg output (default)
          1: png output using gnuplot (.plt) intermediate 
  -o      Prefix for .svg, .plt and .png outputs (default: maze)

Issues

The arcs in the circular mazes are plotted as parametric curves in gnuplot, and png can take quite long to render for large mazes.

mazegenerator's People

Contributors

razimantv avatar retsyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mazegenerator's Issues

Compilation error

When running make I get this error:

circularhexagonmaze.cpp: In member function ‘virtual std::tuple<double, double, double, double> CircularHexagonMaze::GetCoordinateBounds() const’:
circularhexagonmaze.cpp:45:39: error: converting to ‘std::tuple<double, double, double, double>’ from initializer list would use explicit constructor ‘constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {int, int, const int&, const int&}; <template-parameter-2-2> = void; _Elements = {double, double, double, double}]’
   return {-size_, -size_, size_, size_};
                                       ^
makefile:15: recipe for target 'circularhexagonmaze.o' failed
make: *** [circularhexagonmaze.o] Error 1

Compiler used:

gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 

I tried changing c++11 to c++17 (according to notes in http://en.cppreference.com/w/cpp/utility/tuple), but It still gave the same error.
It compiled successfully by replacing list-initialization with std::make_tuple in the project.

Can you also add solutions?

Hello razimantv,
this is a great project, Love it!
Is there a chance you can provide SVG/png solutions to the maze create?
Like when you generate a maze, its corresponding solution is also generated?

Kind regards,
Eiri

License

It could be a good idea to specify which license you are using for this project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.