-
Notifications
You must be signed in to change notification settings - Fork 0
Ruk33/astar
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
astar / path finding this is a very simple path finding function. from two points, it will calculate the next step to walk that's closer to the end goal. this is intended to be extremely simple and easy to follow, no messing around with extra steps or trying to be fancy. if you are strugling with path finding as i was a few months ago, this could be your solution. how to use it? first, make sure you implement the functions: - points_are_equal: checks if two points are equal. - point_is_walkable: checks if a point is walkable (ie, is terrain?) - point_has_obstacle: checks if a point, even if walkable, contains an obstacle (ie, another unit, a wall, etc.) after that, the function find_path can be called to get/calculate the next step from start to end. this is, imagine you have the following map/grid: [s][x][x][x][x][x][x][e] where s = start and e = end. upon calling find_path, the result would be (r): [s][r][x][x][x][x][x][e] call it again from result to get closer and closer to the destination: [x][s][x][x][x][x][x][e] would result in: [x][s][r][x][x][x][x][e] find_path will return 1 if the path is possible, or 0 if not. license whatever, mit?
About
simple path finding / a star code.