Skip to content
forked from ottyanna/aMAZEd

A simple C++ program to generate and solve mazes

License

Notifications You must be signed in to change notification settings

eguiraud/aMAZEd

 
 

Repository files navigation

aMAZEd

Static Badge Static Badge Static Badge Static Badge GitHub last commit

aMAZEd is a c++ program that lets you create and solve a rectangular maze rendered using OpenGL. It can be watched as it processes the maze itself.

The algorithms used for this project are RandomDFS for generation and A* search, DFS, BFS and Dijkstra for solving. It can be used as a tool for visualizing these algorithms as they work. See Example and Description section for a better understanding of colors.

Demo-Preview

mazeA*

Table of contents

Installation

↑ Back to top

Dependencies

  • C++ Compiler (at least C++17)
  • CMake (at least version 3.12)
  • GLFW (at least version 3.4)
  • Boost (at least version 1.84)

If you're willing to use conda, or if you already do, all the above dependencies can be installed via

$ conda env create -f requirements.yaml

You must do this after the downloading part.

Note that this creates a maze conda environment that needs to be activated.

Download and building

You can download the last release here and unpack it

$ tar -xvf /path/to/tar #or zip file -C /path/to/your/directory

or if you want, you can clone this repository

$ git clone https://github.com/ottyanna/aMAZEd.git

Once done this, follow the instructions below in order to compile this code in your own directory.

$ cd /path/to/your/directory  
$ # (if you're using conda -> conda activate <envname>)
$ mkdir build
$ cd build
$ cmake -DBUILD_SHARED_LIBS=ON ..
$ make

Usage

↑ Back to top

To execute the program run

$ ./exe [OPTIONS]

The [OPTIONS] are:

  • 0 to generate a simple 50x50 maze without solving it. The program also adds some loops.
  • a to generate and solve (A* search) a 50x50 maze with fixed delay of generation
  • b to generate a 180x100 maze with loops and solve it with all the algorithms with fixed delay in between to see the result
  • c same as b to time the solving algorithms without the visualizing part
  • d same as b but without loops
  • e same as c but without loops

Feel free to tweak the main.cpp to set the delay variables (in milliseconds) and watch how the path finding algorithms work or change the dimension or the starting and ending point of the maze.

Examples and description

↑ Back to top

Running ./exe a will generate the following:

  • the 50x50 maze with loops, where green and cyan represent the starting and ending points, respectively.

    maze

  • the shortest path in pink found by A*, where the violet and yellow represent the explored nodes.

    solution

Additional material (Italian only)

↑ Back to top

There is a little presentation of the project in the Presentation folder. Feel free to check that out.

Contribute

↑ Back to top

If you wish to contribute or you found any bug, feel free to open an issue or a pull request on the GitHub repository.

Release History

↑ Back to top

See CHANGELOG file.

License

↑ Back to top

GNU GPLv3.0


Static Badge

About

A simple C++ program to generate and solve mazes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.1%
  • CMake 3.9%