|
|
@ -1,6 +1,8 @@
|
|
|
|
package technology.zim
|
|
|
|
package technology.zim
|
|
|
|
|
|
|
|
|
|
|
|
import technology.zim.data.Tile
|
|
|
|
import technology.zim.data.Tile
|
|
|
|
|
|
|
|
import java.text.NumberFormat
|
|
|
|
|
|
|
|
import java.util.Locale
|
|
|
|
import kotlin.time.measureTime
|
|
|
|
import kotlin.time.measureTime
|
|
|
|
|
|
|
|
|
|
|
|
class HierarchicalPathfinding {
|
|
|
|
class HierarchicalPathfinding {
|
|
|
@ -29,13 +31,13 @@ class HierarchicalPathfinding {
|
|
|
|
MapBackedPathfinder.generatePath(Tile(0, 0), Tile(n - 1, (n - 1)))
|
|
|
|
MapBackedPathfinder.generatePath(Tile(0, 0), Tile(n - 1, (n - 1)))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val numberFormat = NumberFormat.getInstance(Locale.US)
|
|
|
|
println(World.toString())
|
|
|
|
println(World.toString())
|
|
|
|
println(n*n)
|
|
|
|
println(numberFormat.format(n*n))
|
|
|
|
println("Maze build time: ${buildMazeTime.inWholeMilliseconds} ms")
|
|
|
|
println("Maze build time: ${numberFormat.format(buildMazeTime.inWholeMilliseconds)} ms")
|
|
|
|
println("BFS Pathfinder time: ${bfsPathfinderTime.inWholeMilliseconds}ms")
|
|
|
|
println("BFS Pathfinder time: ${numberFormat.format(bfsPathfinderTime.inWholeMilliseconds)}ms")
|
|
|
|
println("Array-Backed Pathfinder time: ${arrayBackedPathfinderTime.inWholeMilliseconds}ms")
|
|
|
|
println("Array-Backed Pathfinder time: ${numberFormat.format(arrayBackedPathfinderTime.inWholeMilliseconds)}ms")
|
|
|
|
println("HashMap-Backed Pathfinder time: ${mapBackedPathfinderTime.inWholeMilliseconds}ms")
|
|
|
|
println("HashMap-Backed Pathfinder time: ${numberFormat.format(mapBackedPathfinderTime.inWholeMilliseconds)}ms")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun buildMaze(n: Int) {
|
|
|
|
fun buildMaze(n: Int) {
|
|
|
|