mirror of
https://github.com/Assasinnys/ED-AStar-Galaxy-Router
synced 2025-04-12 14:37:13 +03:00
refactor: change func findStarPointWithMinCost
This commit is contained in:
parent
670e833120
commit
d66058daa8
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +1,2 @@
|
||||
21
|
||||
4
|
||||
37
|
||||
19
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -74,14 +74,10 @@ class AStarMain(private val startSystem: String, private val finishSystem: Strin
|
||||
}
|
||||
|
||||
private fun findStarPointWithMinCost(): StarPoint {
|
||||
var nextStarPoint = openedList[0]
|
||||
openedList.forEach { point ->
|
||||
when {
|
||||
// point.isNeutronStar -> return point
|
||||
point.costF < nextStarPoint.costF -> nextStarPoint = point
|
||||
}
|
||||
return openedList.minBy { starPoint -> starPoint.costF }!!.also { nextStarPoint ->
|
||||
println("Min cost star point: G = ${nextStarPoint.costG}, F = ${nextStarPoint.costF}, " +
|
||||
"dist = ${nextStarPoint.distance}, start = ${nextStarPoint.previousStarPoint == startStarPoint}")
|
||||
}
|
||||
return nextStarPoint
|
||||
}
|
||||
|
||||
private fun findNeighbours(starPoint: StarPoint) {
|
||||
|
@ -69,15 +69,10 @@ class AStarMainFile {
|
||||
}
|
||||
|
||||
private fun findStarPointWithMinCost(): StarPoint {
|
||||
var nextStarPoint = openedList[0]
|
||||
openedList.forEach { point ->
|
||||
when {
|
||||
// point.isNeutronStar -> return point
|
||||
point.costF < nextStarPoint.costF -> nextStarPoint = point
|
||||
}
|
||||
return openedList.minBy { starPoint -> starPoint.costF }!!.also { nextStarPoint ->
|
||||
println("Min cost star point: G = ${nextStarPoint.costG}, F = ${nextStarPoint.costF}, " +
|
||||
"dist = ${nextStarPoint.distance}, start = ${nextStarPoint.previousStarPoint == startStarPoint}")
|
||||
}
|
||||
println("Min cost star point: G = ${nextStarPoint.costG}, F = ${nextStarPoint.costF}, dist = ${nextStarPoint.distance}, start = ${nextStarPoint.previousStarPoint == startStarPoint}")
|
||||
return nextStarPoint
|
||||
}
|
||||
|
||||
private fun findNeighbours(starPoint: StarPoint) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user