From 8b0fa7f4049d2e9a404e8e5bd54d492bea0d3b2e Mon Sep 17 00:00:00 2001 From: Bryson Zimmerman Date: Thu, 7 Nov 2024 14:37:42 -0500 Subject: [PATCH] Unused code and old notes cleanup --- src/main/kotlin/Main.kt | 19 ------------------- src/main/kotlin/PathFinder.kt | 13 ------------- src/main/kotlin/data/Tile.kt | 2 -- src/main/kotlin/data/TileHeap.kt | 15 --------------- 4 files changed, 49 deletions(-) diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index ca3a5c2..582ac23 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -1,26 +1,7 @@ package technology.zim import technology.zim.data.Tile -import kotlin.times -import kotlin.toString -/* -Adjacency matrix for graph representation. 5k x 5k or 10k x 10k are safe goals, for memory -Working with a gigantic grid that's mostly full: better to have a up/right/down/left data in each one or a huge adjacency matrix? -Minimum int size is probably 32 or 64 bit, so huge memory waste if that's used - - -Abandon fancy stretch goals, just get pathfinding done and scale it up to demonstrate large scale - */ - - -//TODO: Figure out why attempted connections out of bounds are happening -/* -Building world -Start -Attempted to connect to outside bounds: <44, 50> From Tile: <44, 49> -no explored found - */ class HierarchicalPathfinding { companion object { diff --git a/src/main/kotlin/PathFinder.kt b/src/main/kotlin/PathFinder.kt index 5f604db..5ee46e6 100644 --- a/src/main/kotlin/PathFinder.kt +++ b/src/main/kotlin/PathFinder.kt @@ -82,17 +82,4 @@ object PathFinder { World.update(start, start.getProperties() + Directions.INPATH) } - - //Heuristic value, to estimate the cost of a given tile - fun hValue(prospect: Tile, end: Tile): Int { - return abs(prospect.x() - end.x()) + abs(prospect.y() - end.y()) - } - - - //Step through the path, marking each Tile with INPATH - fun finalizePath() { - - } - - } \ No newline at end of file diff --git a/src/main/kotlin/data/Tile.kt b/src/main/kotlin/data/Tile.kt index eb158bf..2018cf4 100644 --- a/src/main/kotlin/data/Tile.kt +++ b/src/main/kotlin/data/Tile.kt @@ -1,7 +1,6 @@ package technology.zim.data import technology.zim.World -import java.util.HashMap //Tile is a ULong that represents the X,Y coordinates of a Tile //Contains functions necessary for accessing and manipulating Tiles @@ -117,7 +116,6 @@ value class Tile(private val value: ULong) { fun getConnections(): Set { val connections = mutableSetOf() val properties = getProperties() - val north = Directions.UP.dir if(properties.connections and(Directions.UP.dir) != 0) { connections.add(this + Directions.NORTH) } diff --git a/src/main/kotlin/data/TileHeap.kt b/src/main/kotlin/data/TileHeap.kt index f2ec4ac..c9cbfc2 100644 --- a/src/main/kotlin/data/TileHeap.kt +++ b/src/main/kotlin/data/TileHeap.kt @@ -63,21 +63,6 @@ class TileHeap(val end: Tile, val gVals: HashMap) { } } - fun peekMax(): Tile { - if(dat.isEmpty()) { - throw ArrayIndexOutOfBoundsException() - } - - return dat.last() - } - - fun peekMin(): Tile { - if(dat.isEmpty()) { - throw ArrayIndexOutOfBoundsException() - } - return dat[1] - } - //Helper functions for navigating the heap private fun parent(index: Int): Int = index / 2 private fun leftChild(index: Int): Int = index * 2