diff --git a/src/main/kotlin/TestingClass.kt b/src/main/kotlin/TestingClass.kt deleted file mode 100644 index 3297e9b..0000000 --- a/src/main/kotlin/TestingClass.kt +++ /dev/null @@ -1,7 +0,0 @@ -package technology.zim - -class TestingClass { - fun basic(): Boolean { - return true - } -} \ No newline at end of file diff --git a/src/main/kotlin/World.kt b/src/main/kotlin/World.kt index ac227c1..3d357b0 100644 --- a/src/main/kotlin/World.kt +++ b/src/main/kotlin/World.kt @@ -22,6 +22,16 @@ object World { val tiles = WorldData(ArrayList>()) var sizeX = 10 var sizeY = 10 + const val ANSI_RESET = "\u001B[0m" + const val ANSI_BLACK = "\u001B[30m" + const val ANSI_RED = "\u001B[31m" + const val ANSI_GREEN = "\u001B[32m" + const val ANSI_YELLOW = "\u001B[33m" + const val ANSI_BLUE = "\u001B[34m" + const val ANSI_PURPLE = "\u001B[35m" + const val ANSI_CYAN = "\u001B[36m" + const val ANSI_WHITE = "\u001B[37m" + fun update(tile: Tile, to: TileProperties) { tiles.value[tile.x()][tile.y()] = to @@ -45,15 +55,6 @@ object World { //TODO: https://en.wikipedia.org/wiki/Box-drawing_characters //^ make the maze look like a maze override fun toString(): String { - val ANSI_RESET = "\u001B[0m" - val ANSI_BLACK = "\u001B[30m" - val ANSI_RED = "\u001B[31m" - val ANSI_GREEN = "\u001B[32m" - val ANSI_YELLOW = "\u001B[33m" - val ANSI_BLUE = "\u001B[34m" - val ANSI_PURPLE = "\u001B[35m" - val ANSI_CYAN = "\u001B[36m" - val ANSI_WHITE = "\u001B[37m" val str = StringBuilder() var inPath = false @@ -62,15 +63,15 @@ object World { for (y in 0..tiles.value[0].size - 1) { //Upper line: Print each tile, print right-hand connections for (x in 0..tiles.value[0].size - 1) { - if(World.get(Tile(x, y)).connections and(INPATH.dir) != 0) + if(get(Tile(x, y)).connections and(INPATH.dir) != 0) inPath = true - else if (World.get(Tile(x, y)).connections and(FRONTIER.dir) != 0) + else if (get(Tile(x, y)).connections and(FRONTIER.dir) != 0) checked = true if(inPath) str.append(ANSI_GREEN) else if(checked) str.append(ANSI_YELLOW) - str.append(getTileShapeDoubles(World.get(Tile(x, y)))) + str.append(getTileShapeDoubles(get(Tile(x, y)))) if(inPath || checked) str.append(ANSI_RESET) inPath = false @@ -102,6 +103,7 @@ object World { else -> '•' } } + fun getTileShapeDoubles(tile: TileProperties): Char { return when(tile.connections and(MANIFEST.inv()) and(INPATH.inv()) and(FRONTIER.inv())) { UP.dir+DOWN.dir+LEFT.dir+RIGHT.dir -> '╬' diff --git a/src/main/kotlin/data/Tile.kt b/src/main/kotlin/data/Tile.kt index 2018cf4..60511e2 100644 --- a/src/main/kotlin/data/Tile.kt +++ b/src/main/kotlin/data/Tile.kt @@ -8,9 +8,7 @@ import technology.zim.World @JvmInline value class Tile(private val value: ULong) { - constructor(x: Int, y: Int): this(pack(x, y)) { - - } + constructor(x: Int, y: Int): this(pack(x, y)) fun connect(candidateTile: Tile) { val dir = toward(candidateTile) diff --git a/src/main/kotlin/data/TileHeap.kt b/src/main/kotlin/data/TileHeap.kt index c9cbfc2..9f53cbd 100644 --- a/src/main/kotlin/data/TileHeap.kt +++ b/src/main/kotlin/data/TileHeap.kt @@ -10,7 +10,7 @@ class TileHeap(val end: Tile, val gVals: HashMap) { val dat = ArrayList() init { //Shove some data into the zero slot - if(dat.isEmpty()) + if(dat.isEmpty) dat.add(Tile(0, 0)) } diff --git a/src/main/kotlin/data/WorldData.kt b/src/main/kotlin/data/WorldData.kt index 61bde6a..b5ea5e0 100644 --- a/src/main/kotlin/data/WorldData.kt +++ b/src/main/kotlin/data/WorldData.kt @@ -9,7 +9,7 @@ value class WorldData(val value: ArrayList>) { val emptyTile = TileProperties(0) //println("WorldData setting to: " + xmin + ", " + ymin) //Fill every column with an ArrayList of TileProperties - value.removeAll({true}) + value.removeAll {true} for(i in 0..xmin-1) { value.add(ArrayList()) @@ -24,8 +24,4 @@ value class WorldData(val value: ArrayList>) { //println("WorldData now sized at: " + value.size + ", " + value[0].size) } - - companion object { - - } } diff --git a/src/test/kotlin/ConsoleTest.kt b/src/test/kotlin/ConsoleTest.kt deleted file mode 100644 index 8b2eb47..0000000 --- a/src/test/kotlin/ConsoleTest.kt +++ /dev/null @@ -1,4 +0,0 @@ -//This doesn't exist to actually test the program, right now. Just to test out colorizing results -class ConsoleTest { - -} \ No newline at end of file diff --git a/src/test/kotlin/TestingClassTest.kt b/src/test/kotlin/TestingClassTest.kt deleted file mode 100644 index 04d5973..0000000 --- a/src/test/kotlin/TestingClassTest.kt +++ /dev/null @@ -1,14 +0,0 @@ -import org.junit.jupiter.api.Test - -import org.junit.jupiter.api.Assertions.* -import technology.zim.TestingClass - -class TestingClassTest { - - @Test - fun basic() { - val test = TestingClass() - val res = test.basic() - assertEquals(true, res) - } -} \ No newline at end of file