Skip to content

yonimn2000/path-star

Repository files navigation

Path Star

.NuGet Publish NuGet

A simple library that uses the A* path finding algorithm to find paths on 2D grids.

How to Use

Size gridSize = new Size(45, 20);
Point startPoint = new Point(0, 0);
Point endPoint = new Point(gridSize.Width - 1, gridSize.Height - 1);
List<Point> wallPoints = new List<Point>();
Random random = new Random();

for (int i = 0; i < gridSize.Width * gridSize.Height * 0.3; i++) // Create random walls points.
    wallPoints.Add(new Point(random.Next(gridSize.Width), random.Next(gridSize.Height)));

IGridAstar gridAstar = new GridAstar(gridSize, startPoint, endPoint, wallPoints);

gridAstar.FindPath();

List<Point> pathPoints = gridAstar.Path;

Visualization

Screenshots

Gray = walls

Blue = closed set

Green = open set

Yellow = path

My Other Project that Uses This Library

Command Line Snake

About

A simple library that uses the A* path finding algorithm to find paths on 2D grids.

Topics

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages