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.
24 lines
690 B
24 lines
690 B
package technology.zim
|
|
|
|
import technology.zim.data.Tile
|
|
|
|
object BFSPathFinder {
|
|
//In this particular situation, only a single outcome is likely. Thus, BFS always finds the perfect (and only) path
|
|
//Skipping the Heap data structure allows better utilization of on-die cache
|
|
|
|
fun generatePath(start: Tile, end: Tile) {
|
|
if (!start.isInBounds() || !end.isInBounds()) {
|
|
throw IndexOutOfBoundsException("Cannot generate a path to or from an out of bounds tile")
|
|
}
|
|
|
|
if (start == end) {
|
|
println("Ouroboros detected")
|
|
return
|
|
}
|
|
|
|
//Queue for tiles to be checked
|
|
val frontier = ArrayDeque<Tile>()
|
|
|
|
}
|
|
|
|
} |