You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package technology.zim
|
|
|
|
|
|
|
|
import technology.zim.data.Tile
|
|
|
|
|
|
|
|
class HierarchicalPathfinding {
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
@JvmStatic
|
|
|
|
fun main(args: Array<String>) {
|
|
|
|
val n = 50
|
|
|
|
buildMaze(n)
|
|
|
|
val startTime = System.currentTimeMillis()
|
|
|
|
PathFinder.generatePath(Tile(0, 0), Tile(n-1, (n-1)))
|
|
|
|
val endTime = System.currentTimeMillis()
|
|
|
|
println(World.toString())
|
|
|
|
println(n*n)
|
|
|
|
println((endTime - startTime).toString() + "ms")
|
|
|
|
}
|
|
|
|
|
|
|
|
fun buildMaze(n: Int) {
|
|
|
|
|
|
|
|
println("Building world")
|
|
|
|
World.setSize(n, n)
|
|
|
|
println("Start")
|
|
|
|
|
|
|
|
try {
|
|
|
|
MazeFinder.primsAlgorithm()
|
|
|
|
} catch(e: Exception) {
|
|
|
|
println(World.toString())
|
|
|
|
println(e.message)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|