Skip to content

First attempt in making a visualization of A* path finding algorithm.

Notifications You must be signed in to change notification settings

aliahmed58/A-star-pathfinding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visualizing A* path finding algorithm

Visualizing the A* search algorithm in pygame. :)

Cost criteria:

  • H cost = dx + dy, where dx and dy is the absolute distance between goal and current cell
  • G cost = 14 if cell is diagonal else G cost = 10
  • Total cost = H cost + G cost

To allow diagonal movement, set diagonal_allowed = True in constants.py.

How to run:

  • Install required packages by pip install -r requirements.txt
  • Run main.py

How to use:

  • How to select the start node (red):
    • Press S and then click a square on the grid
    • Undo by pressing S and then right-click on the start node
  • How to select the goal node (green):
    • Press G and then click on a square on the grid
    • Undo by pressing G and then right-click on the goal node
  • Reset the screen by pressing R
  • Draw walls on the screen by pressing D
  • Clear walls drawn on screen by pressing C and hovering over the walls.
  • Exit drawing mode by pressing Spacebar
  • To start visualizing search, press Enter : only after start and goal node has been set.

About

First attempt in making a visualization of A* path finding algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages