From 7d1ec41f06f92aac8fb6f7f96d222da96febe8ba Mon Sep 17 00:00:00 2001 From: Bryson Zimmerman Date: Tue, 19 Nov 2024 12:33:13 -0500 Subject: [PATCH] Add commas for large numbers, add notes for next step --- src/main/kotlin/Main.kt | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index 8612ad4..095e6d1 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -1,11 +1,20 @@ package technology.zim import technology.zim.data.Tile -import java.text.NumberFormat import java.util.Locale import kotlin.time.measureTime class HierarchicalPathfinding { + /* + Next steps: + Dump results as CSV + Dump ANSI text to file for processing into image + Add command line options to run particular pathfinders, render particular pathfinder's markings + Add HPA*, should be a bit easier with existing abstractions. Hard part will be the path calculations + Use R to render syntax highlights https://github.com/KDE/syntax-highlighting/blob/master/data/syntax/kotlin.xml + https://pandoc.org/MANUAL.html#syntax-highlighting + https://hamel.dev/notes/quarto/highlighting.html + */ companion object { @JvmStatic @@ -31,13 +40,14 @@ class HierarchicalPathfinding { MapBackedPathfinder.generatePath(Tile(0, 0), Tile(n - 1, (n - 1))) } - val numberFormat = NumberFormat.getInstance(Locale.US) + println(World.toString()) - println(numberFormat.format(n*n)) - println("Maze build time: ${numberFormat.format(buildMazeTime.inWholeMilliseconds)} ms") - println("BFS Pathfinder time: ${numberFormat.format(bfsPathfinderTime.inWholeMilliseconds)}ms") - println("Array-Backed Pathfinder time: ${numberFormat.format(arrayBackedPathfinderTime.inWholeMilliseconds)}ms") - println("HashMap-Backed Pathfinder time: ${numberFormat.format(mapBackedPathfinderTime.inWholeMilliseconds)}ms") + print("Tiles in Maze: ") + println(String.format(Locale.US, "%,d", n*n)) + println("Maze build time: ${String.format(Locale.US, "%,d",buildMazeTime.inWholeMilliseconds)} ms") + println("BFS Pathfinder time: ${String.format(Locale.US, "%,d",bfsPathfinderTime.inWholeMilliseconds)}ms") + println("Array-Backed A* Pathfinder time: ${String.format(Locale.US, "%,d",arrayBackedPathfinderTime.inWholeMilliseconds)}ms") + println("HashMap-Backed A* Pathfinder time: ${String.format(Locale.US, "%,d",mapBackedPathfinderTime.inWholeMilliseconds)}ms") } fun buildMaze(n: Int) {