← A* Pathfinding
Authors:
Tags:
dependencies:
- https://github.com/korlibs/korge-ext/tree/v0.1.2/korma-astar##de29df486b4cf755a5ab32b35a64c06f9f7722d0
Adds support for A*
pathfinding for bidimensional boolean arrays: true for blocking cells, false for available cells.
val map = AStar(BooleanArray2.fromString(mapOf('X' to true, '.' to false), false, code = """
.X...X....
.X...X....
.X.X.X....
...X.X....
...X......
...X......
""".trimIndent()))
val points = map.find(0, 1, 6, 2, findClosest = true, diagonals = true)
println(points)
// [(0, 1), (0, 2), (1, 3), (2, 2), (3, 1), (4, 2), (4, 3), (5, 4), (6, 3), (6, 2)]