Skip to content

kabasakalis/cpp-maze

Repository files navigation

C++ Maze


Overview

Build and solve a virtual maze with C++.

A 73 x 38 Maze, solving process. Solver is yellow dot.

screenshot

A 73 x 38 Maze, building process. Builder is yellow dot.

screenshot

Prerequisites


The codebase was developed and tested on Ubuntu 16.04.

You don't have to install Boost manually, it will be installed with Hunter package manager, when you configure and build the project, (see below). You have to install SFML library manually though, easy as running sudo apt-get install libsfml-dev in your terminal (for Ubuntu). See other installation options in SFML getting started page.

Configuring and Building the project with CMake, (release).


  • Run ./configure two times for release configuration.
  • Run cmake --build build to build the project in build folder.

Configuring and Building the project with CMake, (debug).


  • Run ./configure debug two times for debug configuration.
  • Run cmake --build build-debug to build the project in build-debug folder.

Usage.


  • Release: build/cppmaze [columns] [rows] [mode]
  • Debug: build-debug/cppmazed [columns] [rows] [mode]

Columns ranges from 1 to 73, rows from 1 to 38. You can change these ranges in the code, but the maze will probably exceed the screen boundaries if you increase the maximum values.

Mode is 0 if you want to watch the built maze only and 1 if you want to watch the maze solved. Default start and goal positions are {1,1} and the bottom right corner of the maze respectively, I did'nt make these configurable through the command line, but you can easily modify the code and choose any start and goal positions.

You can control the speed of the animation with the framerate, see source/main/main.cpp. Default setting is window.setFramerateLimit(30);.

Usage Examples:

  • build/cppmaze 73 38 0, will build a maze of 2774 rooms, you will watch the building process.
  • build/cppmaze 40 20 1, will build a maze of 800 rooms, you will watch the solving process.

Tests

Run tests with cmake --build build-debug --target test

License

MIT License.

About

C++ Port of my ruby-maze

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published