Added distinct path tracking for each algorithm

main
Bryson Zimmerman 11 months ago
parent e30c8f03d6
commit 007779ce36

@ -46,7 +46,7 @@ object MapBackedPathfinder {
//Otherwise, the tile has been reached and this path is not better, so carry on
gVals.put(candidateTile, currentG + 1)
frontier.insert(candidateTile)
World.update(candidateTile, candidateTile.getProperties() +Directions.FRONTIER)
World.update(candidateTile, candidateTile.getProperties() +Directions.HMFRONTIER)
}
}
} while( current != end)
@ -70,7 +70,7 @@ object MapBackedPathfinder {
var lowestG = Int.MAX_VALUE
var lowestCost = end
while(current != start) {
World.update(current, current.getProperties() + Directions.INPATH)
World.update(current, current.getProperties() + Directions.HMINPATH)
current.getConnections().forEach { candidateTile ->
val candidateG = gVals.get(candidateTile) ?: -1
if(candidateTile.isInBounds() && candidateG != -1 && candidateG < lowestG ) {

@ -7,9 +7,13 @@ enum class Directions(val dir: Int) {
LEFT(4),
RIGHT(8),
MANIFEST(16),//Was added to MazeFinder's frontier, but the pathfinder has a frontier so this is named something other than frontier
FRONTIER(32), //Added to the pathfinder's frontier
INPATH(64), //Chosen by the pathfinder
NOPATH(128) //Tile is not a viable path
FRONTIER(32), //Added to the ArrayBackedPathfinder's frontier
INPATH(64), //Chosen by the ArrayBackedPathfinder
HMFRONTIER(128), //Tile is not a viable path
HMINPATH(256),
BFSFRONTIER(512),
BFSINPATH(1024),
;
companion object {

Loading…
Cancel
Save