← A* Pathfinding
Authors:
Tags:
dependencies:
- https://github.com/korlibs/korge-ext/tree/v0.1.3/korma-astar##2a331af4bab999c105c5f945b152e5f95dbf49f1
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)]