Git Product home page Git Product logo

scrayil / randommazesolver Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 55.05 MB

RandomMazeSolver is a program capable of generating and solving mazes randomly. It also makes use of the parallelism paradigms offered by the OpenMP library in order to speed the execution up.

License: GNU General Public License v2.0

CMake 4.17% C++ 95.83%
ascii backtracking-algorithm generative-art maze-generator maze-solver openmp openmp-parallelization particles pathfinding random-generation random-solver seed maze paralelism parallel-programming parallelization sequential square demo intermediate

randommazesolver's Introduction

RandomMazeSolver

RandomMazeSolver is a program capable of generating and solving mazes randomly. It consists of two different versions:

  • the sequential one in which all the instructions are executed serially
  • the parallel one that is realized by using parallelization paradigms based onto the OpenMP library

The execution is based onto a configuration file in which some parameters can be specified.
The parameters include things like the number of executions to perform, the versions of the program to execute, the size of the maze, the number of particles to generate and so on.
Specific seeds can eventually be set in order to generate predictable mazes and their relative solutions.
Note: If not specified, at each execution seeds are randomly generated, but both versions in the same execution will share the same values for consistency.

Reporting

The project has been used as an example to show and evaluate the benefits of parallelization over the sequential execution of the code.
Results and reports have been included into this repository.
For simplicity maze's images have been generated by using ascii characters and they look as follows:

Solved maze's image

Here is a sample report that shows the records related to the above maze's image:

version,elapsed_time,maze_size,n_particles,generation_seed,solution_seed,maze_image_path
sequential,2614.78,51,10000,3934329779,968699857,"/home/scrayil/Desktop/dev/University/projects/PPFML/RandomMazeSolver/results/mazes/sequential_23-05-19T17:19:35_968699857.txt"
parallel,285.342,51,10000,3934329779,968699857,"/home/scrayil/Desktop/dev/University/projects/PPFML/RandomMazeSolver/results/mazes/parallel_23-05-19T17:19:35_968699857.txt"

Demo

The following animation has been consistently slowed down in order to show the generation and solution steps of a maze of size 51x51 with 10,000 particles.

Maze generation and solution steps animation

Notes

Showing intermediate steps while generating and solving big mazes by using a big amount of particles results into slow console updates, flickering and an harsh visual experience.
This will heavily slow down the code execution.

At the moment the mazes' images filenames generation does guarantee uniqueness if the generation and the solution of 2 consecutive mazes don't happen during the same second.
If 2 small mazes are solved consecutively in the same second (timestamp), the uniqueness is guaranteed only if different seeds have been used between the two executions. (default)

This software includes third-party code for parsing json files.

  • The json parser has been taken from nlohmann

License

Copyright 2023 Mattia Bennati
Licensed under the GNU GPL V2: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html

randommazesolver's People

Contributors

scrayil avatar

Watchers

 avatar

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.