diff --git a/src/main/kotlin/PathFinder.kt b/src/main/kotlin/PathFinder.kt index 9410470..f152bda 100644 --- a/src/main/kotlin/PathFinder.kt +++ b/src/main/kotlin/PathFinder.kt @@ -9,7 +9,6 @@ import kotlin.math.abs //and https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Comparator.html object PathFinder { - val path = ArrayDeque() //work along the path, marking tiles with VISITED along the way //if marking with visited is too expensive, just make the path and finalize it @@ -18,12 +17,21 @@ object PathFinder { throw IndexOutOfBoundsException("Cannot generate a path to or from an out of bounds tile") } + if(start == end) { + println("Ouroboros detected") + return + } + + //Figure out what open and closed queues are for + + + //return a list of steps } //Heuristic value, to estimate the cost of a given tile diff --git a/src/main/kotlin/data/Directions.kt b/src/main/kotlin/data/Directions.kt index 60e80a4..bc2b74a 100644 --- a/src/main/kotlin/data/Directions.kt +++ b/src/main/kotlin/data/Directions.kt @@ -8,7 +8,7 @@ enum class Directions(val dir: Int) { RIGHT(8), INPATH(16), //Chosen by the pathfinder CHECKED(32), //Checked by the pathfinder - MANIFEST(64), //Checked by MazeFinder + MANIFEST(64), //Checked by MazeFinder, the imperialist way ; companion object { diff --git a/src/test/kotlin/MazeFinderTest.kt b/src/test/kotlin/MazeFinderTest.kt index 4a3fbe0..e464d67 100644 --- a/src/test/kotlin/MazeFinderTest.kt +++ b/src/test/kotlin/MazeFinderTest.kt @@ -1,6 +1,4 @@ -import org.junit.jupiter.api.Test - -import org.junit.jupiter.api.Assertions.* +import kotlin.test.Test import technology.zim.MazeFinder import technology.zim.World import technology.zim.data.Tile diff --git a/src/test/kotlin/TileTest.kt b/src/test/kotlin/TileTest.kt index 8c42092..66b6ace 100644 --- a/src/test/kotlin/TileTest.kt +++ b/src/test/kotlin/TileTest.kt @@ -1,7 +1,6 @@ -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.BeforeTest import org.junit.jupiter.api.Assertions.* -import technology.zim.MazeFinder import technology.zim.World import technology.zim.data.* import technology.zim.data.Directions.* @@ -30,10 +29,10 @@ class TileTest { val startTile = Tile(1, 1) var endTile = startTile - endTile = endTile + LEFT - endTile = endTile + UP - endTile = endTile + RIGHT - endTile = endTile + DOWN + endTile += LEFT + endTile += UP + endTile += RIGHT + endTile += DOWN assert(startTile == endTile) } @@ -103,7 +102,6 @@ class TileTest { someTile.connect(northTile) someTile.connect(DOWN) - val world = World.tiles val adjacent = someTile.getAdjacentTiles(false) val explored = someTile.getAdjacentTiles(true) println("Connections of tiles in adjacent (should be westTile and eastTile)")