main
Bryson Zimmerman 11 months ago
parent f709e4dc01
commit bf63f78a9f

@ -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 //and https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Comparator.html
object PathFinder { object PathFinder {
val path = ArrayDeque<Tile>()
//work along the path, marking tiles with VISITED along the way //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 //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") 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 //Heuristic value, to estimate the cost of a given tile

@ -8,7 +8,7 @@ enum class Directions(val dir: Int) {
RIGHT(8), RIGHT(8),
INPATH(16), //Chosen by the pathfinder INPATH(16), //Chosen by the pathfinder
CHECKED(32), //Checked by the pathfinder CHECKED(32), //Checked by the pathfinder
MANIFEST(64), //Checked by MazeFinder MANIFEST(64), //Checked by MazeFinder, the imperialist way
; ;
companion object { companion object {

@ -1,6 +1,4 @@
import org.junit.jupiter.api.Test import kotlin.test.Test
import org.junit.jupiter.api.Assertions.*
import technology.zim.MazeFinder import technology.zim.MazeFinder
import technology.zim.World import technology.zim.World
import technology.zim.data.Tile import technology.zim.data.Tile

@ -1,7 +1,6 @@
import org.junit.jupiter.api.Test import kotlin.test.Test
import kotlin.test.BeforeTest import kotlin.test.BeforeTest
import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Assertions.*
import technology.zim.MazeFinder
import technology.zim.World import technology.zim.World
import technology.zim.data.* import technology.zim.data.*
import technology.zim.data.Directions.* import technology.zim.data.Directions.*
@ -30,10 +29,10 @@ class TileTest {
val startTile = Tile(1, 1) val startTile = Tile(1, 1)
var endTile = startTile var endTile = startTile
endTile = endTile + LEFT endTile += LEFT
endTile = endTile + UP endTile += UP
endTile = endTile + RIGHT endTile += RIGHT
endTile = endTile + DOWN endTile += DOWN
assert(startTile == endTile) assert(startTile == endTile)
} }
@ -103,7 +102,6 @@ class TileTest {
someTile.connect(northTile) someTile.connect(northTile)
someTile.connect(DOWN) someTile.connect(DOWN)
val world = World.tiles
val adjacent = someTile.getAdjacentTiles(false) val adjacent = someTile.getAdjacentTiles(false)
val explored = someTile.getAdjacentTiles(true) val explored = someTile.getAdjacentTiles(true)
println("Connections of tiles in adjacent (should be westTile and eastTile)") println("Connections of tiles in adjacent (should be westTile and eastTile)")

Loading…
Cancel
Save