Skip to content

A* algorithm visualizer in the terminal with color output, implemented in C++. Providing an interactive and educational demonstration of the algorithm's functionality. Additionally you can create your own mazes.

License

Notifications You must be signed in to change notification settings

ArnauCS03/AStar-Pathfinding-Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A* Pathfinding Visualizer

Visualization of the algorithm in the terminal with color output, implemented in C++. Providing an interactive and educational demonstration of the A* functionality.

This project includes code from the original work by LukeProducts.


Credits

AStar Pathfinding Cpp Implementation

Maze Generator


Description

This project aims to visualize the A* pathfinding algorithm in a terminal environment, with this key features:

  • Create a maze distribution with a start and finish point.

  • Witness the algorithm in action as it displays the shortest path on the terminal.

  • Modify the color code of the terminal with ANSI scape sequence to indicate the shortest path.

  • The project has two main programs:

    mainDefault has a predefined maze

    mainCustom can read mazes from .txt files located in the folder mazes

    You can create your own maze!

    1. Modify or create another file inside the mazes folder. Name it: mazeX where X is a number.
    2. Specify in the first line the number of rows and columns, separated by a space.
    3. Starting on a new line, the actual maze. The walls with the character #, and don't forget to include a start position s and goal position g.

  • The A* algorithm and functionalities are in AStar.hh

  • The black cells are the walkable paths and the gray the walls.

Getting Started

How to use this project:

  • Download all the files
  • Open a terminal
  • Run these commands to see the visualitzation:

make compile

make runDefault or make runCustom1 (the number specifying the number of the maze txt file)

Disclaimer:

  • The maze10.txt may take 6 seconds to run, and the width of the maze is huge, on some screens my appear cutted.

Extra functionality:

  • If you want to allow diagonal moves, you can set the boolean to true in the main files. (Recommended check the maze3.txt)




Screenshots



Screenshot from 2024-02-08 01-00-20

Screenshot from 2024-02-08 00-58-48

Screenshot from 2024-02-08 01-01-06


About

A* algorithm visualizer in the terminal with color output, implemented in C++. Providing an interactive and educational demonstration of the algorithm's functionality. Additionally you can create your own mazes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published