Merge branch 'main' of euclid.nmu.edu:brzimmer/HierarchicalPathfinding

main
Bryson Zimmerman 11 months ago
commit 4167c5cd71

@ -26,8 +26,6 @@ object MazeFinder {
}
fun primsAlgorithm() {
//Prime the graph with the first connection, which marks the first visited Tiles
val startingTile = World.getRandomLocation()
val tmpIndex = randGen.nextInt(Directions.ALL.size)
@ -72,7 +70,7 @@ object MazeFinder {
current.getAdjacentTiles(false).forEach {
tile ->
val tileprops = World.get(tile)
if(!tileprops.isManifested()) {
if(!tileprops.isManifest()) {
World.update(tile, tileprops + Directions.MANIFEST)
frontier.add(tile)
}

@ -0,0 +1,60 @@
package technology.zim.data
class Heap<T> {
private val dat = ArrayList<T>()
fun popMin(): T {
if(dat.isEmpty()) {
throw ArrayIndexOutOfBoundsException()
}
val ret = dat.first()
//TODO: Sift and such
return dat.first()
}
fun popMax(): T {
if(dat.isEmpty()) {
throw ArrayIndexOutOfBoundsException()
}
val ret = dat.last()
return ret
}
fun insert(value: T) {
dat.add(value)
//TODO: siftUp, siftDown
}
private fun siftUp() {
}
private fun siftDown() {
}
private fun delete() {
}
fun peekMax(): T {
if(dat.isEmpty()) {
throw ArrayIndexOutOfBoundsException()
}
return dat.last()
}
fun peekMin(): T {
if(dat.isEmpty()) {
throw ArrayIndexOutOfBoundsException()
}
return dat[0]
}
}

@ -54,7 +54,7 @@ value class TileProperties(val connections: Int) {
return connections and(DOWN.dir) == DOWN.dir
}
fun isManifested(): Boolean {
fun isManifest(): Boolean {
return connections and(MANIFEST.dir) == MANIFEST.dir
}

Loading…
Cancel
Save