Skip to content

Simple visualizer for labirynth generators and solvers in C++

Notifications You must be signed in to change notification settings

Asymphia/LabirynthAlgorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LabyrinthAlgorithms

C++ application for generating, editing, and solving mazes with visual, step-by-step algorithm animation using SFML.


🚀 Overview

LabyrinthAlgorithms provides a modular architecture separated into core maze logic, generation algorithms, solvers, and a visual front-end built with SFML. It supports multiple maze-generation strategies (DFS, Kruskal, Prim), pathfinding solvers (BFS, Dijkstra, A*), and an interactive editor for manual maze creation.

⚠️ Platform Notice
This application has been developed and tested only on Windows.
While it may compile on Linux or macOS with minimal changes, cross-platform compatibility is not guaranteed at this time.


🧱 Stable Core

The stable-core branch contains the most reliable and well-tested parts of the project.

🔒 If you are integrating or reusing this project, stable-core is the recommended dependency layer.


⚙️ Features

  • Maze generation: DFS, Kruskal, Prim.
  • Pathfinding: BFS, Dijkstra, A*.
  • Interactive GUI (SFML): draw/edit mazes, set start/goal, visualize algorithm progress.
  • Playback controls: slow / pause / fast / skip and adjustable animation delay.
  • File persistence: save/load maze .txt files and results .txt reports.

⚡ Quick Start

Prerequisites

  • C++ 17 compiler
  • SFML 3.0.2
  • CMake 3.10+ (recommended)

Clone the repository

git clone https://github.com/Asymphia/LabyrinthAlgorithms.git
cd LabyrinthAlgorithms

Install dependencies

Windows

Install SFML via vcpkg or download binaries from the SFML website.

Ubuntu/Debian

sudo apt-get update
sudo apt-get install libsfml-dev

macOS

brew install sfml

Enviroment setup

Create required folders (relative to the executable / build folder):

mkdir -p mazes
mkdir -p results

These folders are required at runtime — the FileManager expects ./mazes and ./results.

Build and run

mkdir build && cd build
cmake ..
make
./LabyrinthAlgorithms

📐 System Architecture

The codebase is organized to separate the maze logic, generation/solving algorithms, and visualization.

Maze Core

  • Cell — Represents a single grid unit (Wall or Empty).
  • Maze — Grid container that manages cell states, bounds checking, resizing, and I/O.

Maze Generators

All generators inherit from a MazeGenerator base and provide a history_ log for visualization playback.

  • DFS (Depth-First Search) — long winding corridors, deeper recursion.
  • Kruskal — forest-based merging using Union-Find for a perfect maze.
  • Prim — grows the maze from a random start, producing a different branching structure.

Maze Sovers

Solvers compute the path between a Start and Goal cell:

  • BFS — guaranteed shortest path for unweighted grids.
  • Dijkstra — shortest path over weighted edges (if weights used).
  • A* — optimizes using heuristic (Manhattan). Heuristic formula: f(n) = g(n) + h(n).

📄 File Format

Maze files

Stroned in /mazes folder. Stored as text files with characters:

  • C = Wall
  • B = Empty Filenames generated automatically: maze_1.txt, maze_2.txt,…
CCCCCCCCCCC
CBCBBBBBBBC
CBCBCBCCCCC
CCCCCCCCCCC

Result files

Stored in /results folder. Contain run metadata and solver statistics.


🎨 GUI

The UI is implemented as a simple state machine inside the Simulation class. Typical workflow:

  1. Main Menu — choose to generate, manually draw, or load a file.
  2. Edit Maze — draw or erase walls with mouse.
  3. Select Points — first click sets Start (green), second sets Goal (red).
  4. Visualization — play the algorithm with animation and controls.
  5. Results — view and export statistics.

🤝 Contributing

Feel free to open issues or pull requests for:

  • Additional generation/solving algorithms.
  • Improvements to the GUI and UX.
  • Cross-platform installer scripts or packaging.

Releases

No releases published

Packages

No packages published

Languages