Skip to content

Latest commit

 

History

History
46 lines (27 loc) · 1.61 KB

README.md

File metadata and controls

46 lines (27 loc) · 1.61 KB

A* Algorithm

This repository contains a Python implementation of the A* algorithm with visualization capabilities. It allows users to observe the exploration of nodes and the identified path using matplotlib. The code provides flexibility for experimenting with various heuristic functions to analyze the algorithm's behavior.

Libraries required

  1. pygame
  2. numpy
  3. matplotlib

Usage

  1. Run the program.
  2. Enter the grid size (e.g. 25) when prompted.
  3. Enter the heuristic function to use (e for Euclidean, m for Manhattan).
  4. The program will open a pygame window.
  5. In the window, the green node at the top-left is the start node, and the red node in the bottom-right corner is the goal node.
  6. Drag the mouse on the white area to draw obstacles, then close the window.
  7. The algorithm will start, and upon completion, it will display the output.

Input grid

image

Output with Euclidian:

image

In the output, the blue nodes represent the explored nodes, and the red nodes represent the path.

Input grid:

image

Output using Manhattan:

image

How to Contribute

If you'd like to contribute to this project, feel free to submit a pull request or open an issue.

License

This project is licensed under the MIT License.