diff --git a/src/main/kotlin/PathFinder.kt b/src/main/kotlin/PathFinder.kt index f152bda..ad2a7bd 100644 --- a/src/main/kotlin/PathFinder.kt +++ b/src/main/kotlin/PathFinder.kt @@ -22,9 +22,19 @@ object PathFinder { return } - //Figure out what open and closed queues are for + //Data structure to define the frontier + //Frontier tiles know their current cost: cost of the path until now g(t) + its own distance from the end h(t) + //Always grab the lowest value from the frontier, mark it visited, add its unvisited neighbors + //Probably best to just make an array of integers, where the coordinates store the tile's g(t) + //Data structure to hold the g values + //Data structure to mark parents + //Two choices that I see: + //Dual arrays, one for g-val and one for parent node, take advantage of bitflags in Directions + + //or add a flag for DEADEND, use a more dynamic data structure to store tile data (map?) + //then prune tiles from the data structure when they're marked as dead ends, backtracking until a fork is available diff --git a/src/main/kotlin/data/Directions.kt b/src/main/kotlin/data/Directions.kt index bc2b74a..d86d6d5 100644 --- a/src/main/kotlin/data/Directions.kt +++ b/src/main/kotlin/data/Directions.kt @@ -6,9 +6,10 @@ enum class Directions(val dir: Int) { DOWN(2), LEFT(4), RIGHT(8), - INPATH(16), //Chosen by the pathfinder - CHECKED(32), //Checked by the pathfinder - MANIFEST(64), //Checked by MazeFinder, the imperialist way + MANIFEST(16),//Checked by MazeFinder, the imperialist way + MARKED(32), //Marked as an item to check, from pathfinder + CHECKED(64), //Checked by the pathfinder + INPATH(128), //Chosen by the pathfinder ; companion object {