Coder Social home page Coder Social logo

ramezze / mazesolver Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 838 KB

Maze generation, solving & finding shortest paths algorithms with backtracking, written in C++ and SFML.

License: MIT License

C++ 94.97% Makefile 2.81% CMake 2.23%
backtracking backtracking-algorithm dfs dfs-algorithm maze maze-algorithms maze-generator maze-solver pathfinding shortest-path shortest-path-algorithm shortest-paths

mazesolver's Introduction

Maze Solver

Maze generator & solver using backtracking

Written in C++ and SFML

Maze Solver Preview (Custom) (2)

Table of Contents

Features

  1. Maze Generation
  2. Maze Solving
  3. Finding all shortest paths
  4. Resizing
  5. Adjusting simulation speed & wall thickness
  6. Changing start and end positions
  7. Manually editing the maze
  8. Exporting as an Image

Maze Generation

Randomly generate a maze with initially only 1 solution as many times as you want.

Generate Maze

Solving the Maze

Solve the maze, backtracking at the first solution found.

Solve Maze

Shortest Paths

Find all the shortest paths in the maze and view them all with side arrows.

Find Shortest Paths

Resize the Grid

Resize the grid and regenerate the maze.

Resize Grid

Adjust Speed and Wall Thickness

Pause (speed to 0), slow down or speed up the simulation speed at any time. Increase or decrease the wall thickness.

Change Speed and Wall Thickness

Change Start and End

Change start & end positions for the maze.

Change Start and End

Editing the maze

In edit mode:

Left mouse click toggles the visibility of the top wall of any cell.

Right mouse click does the same for the right wall

Edit Maze

Export as PNG

Export the maze as an image in PNG format.

Mon Jun 19 190400 2023 Mon Jun 19 190427 2023 x

Building

Prerequisites

Linux

  • You can run these commands on linux to install g++, Make and SFML
$ sudo apt-get install g++
$ sudo apt-get install make
$ sudo apt-get install libsfml-dev

Windows

  • Install the proper SFML version from the website (MinGW version for GNU Make build or Visual C++ for MS Build)
  • Unzip the SFML downloaded folder ( You can install 7zip to be able to unzip )

GNU Make

  • Install GNU Make by installing chocolatey package manager and running this command from an elevated Command Prompt:
$ choco install make
  • Install MinGW g++ MinGW 32-bit or MinGW 64-bit (The SFML version and the MinGW version have to match)

  • After unzipping the MinGW file, add your path to mingw32/bin or mingw64/bin to PATH in the system environmental variables

  • Edit the SFML_DIR in the Makefile to add your correct SFML folder or copy the folder to the project directory and name the folder 'SFML'

MS Build

  • Visual Studio 15 or above
  • VC++ 15 or above

Building

GNU Make (Method used)

  • Download source code

  • Open your terminal in your project directory where the Makefile exists

  • Run Make in your terminal:

$ make
  • List of make commands you can use
# Build and run in release mode
$ make

# Build and run in debug mode
$ make debug && make run

# Rebuild in release or debug mode
$ make rebuild

# or 
$ make rebuild-debug

# Clean the files
$ make clean

# Run the latest compiled build
$ make run

MS Build

  1. Add the </path/to/sfml_folder/>/include to your additional C++ include directories.

  2. Add </path/to/sfml_folder/>/lib to your additional library directories.

  3. Add the SFML libraries used to your additional dependencies

    eg: sfml-graphics.lib;sfml-system.lib;sfml-window.lib;

  4. Add the dlls in your SFML path/bin along with your executable

License

This project is licensed under the MIT License.

mazesolver's People

Contributors

ramezze avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

mazesolver's Issues

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.