mirror of
https://github.com/Assasinnys/ED-AStar-Galaxy-Router
synced 2025-04-12 14:37:13 +03:00
fix: delete unused directories
This commit is contained in:
parent
a7af2546dc
commit
16ab778e5c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
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 @@
|
||||
39
|
||||
21
|
||||
23
|
||||
5
|
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.
@ -20,7 +20,6 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.launch
|
||||
import sun.audio.AudioPlayer
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.nio.file.Files
|
||||
@ -67,7 +66,7 @@ var replaces = 0
|
||||
|
||||
fun calcTime(timeStart: Long): Double = System.currentTimeMillis().minus(timeStart).div(1000.0)
|
||||
|
||||
fun startCoroutineQuery(systemName: String) {
|
||||
/*fun startCoroutineQuery(systemName: String) {
|
||||
val coroutineScope = CoroutineScope(Dispatchers.Default)
|
||||
|
||||
coroutineScope.launch {
|
||||
@ -88,7 +87,7 @@ fun startCoroutineQuery(systemName: String) {
|
||||
println("Coroutine complete query ${systemName}. Time: ${calcTime(startCoroutineTime)}")
|
||||
database.closeDB()
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/*fun addToResultList(result: Int) {
|
||||
@ -183,17 +182,6 @@ fun startCoroutineQuery(systemName: String) {
|
||||
//TODO alternative MAIN with work in file
|
||||
/*fun main(args: Array<String>) {
|
||||
println("Start A Star with file table")
|
||||
val thread = Thread{
|
||||
val inputStream = FileInputStream("sound.mp3")
|
||||
val player = Player(inputStream)
|
||||
try {
|
||||
while (true) {
|
||||
player.play()
|
||||
}
|
||||
} finally {
|
||||
player.close()
|
||||
}
|
||||
}.apply { isDaemon = true }.start()
|
||||
|
||||
val time = System.currentTimeMillis()
|
||||
println("Distance modifier $DISTANCE_MODIFIER")
|
||||
|
@ -25,6 +25,7 @@ class AStarMain(private val startSystem: String, private val finishSystem: Strin
|
||||
|
||||
private val openedList = mutableListOf<StarPoint>()
|
||||
private val closedList = mutableListOf<StarPoint>()
|
||||
private val stopwatch = Stopwatch()
|
||||
|
||||
init {
|
||||
openedList.add(startStarPoint)
|
||||
@ -74,15 +75,18 @@ class AStarMain(private val startSystem: String, private val finishSystem: Strin
|
||||
}
|
||||
|
||||
private fun findStarPointWithMinCost(): StarPoint {
|
||||
stopwatch.start()
|
||||
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}")
|
||||
stopwatch.stopWithConsoleOutput("Min cost find time: ")
|
||||
}
|
||||
}
|
||||
|
||||
private fun findNeighbours(starPoint: StarPoint) {
|
||||
checkConnection()
|
||||
|
||||
stopwatch.start()
|
||||
val resultSet = database.query(
|
||||
"select $C_ID64, $C_X, $C_Y, $C_Z, $C_SUBTYPE = 'Neutron Star' as isNeutronStar, " +
|
||||
"$C_SYS_NAME, " +
|
||||
@ -93,6 +97,10 @@ class AStarMain(private val startSystem: String, private val finishSystem: Strin
|
||||
)}" +
|
||||
"and not $C_ID64=${starPoint.systemId64}"
|
||||
)
|
||||
stopwatch.stopWithConsoleOutput("Query time: ")
|
||||
stopwatch.start()
|
||||
|
||||
val sw2 = Stopwatch()
|
||||
|
||||
while (resultSet.next()) {
|
||||
with(resultSet) {
|
||||
@ -103,14 +111,17 @@ class AStarMain(private val startSystem: String, private val finishSystem: Strin
|
||||
), getBoolean("isNeutronStar"), getDouble("dist"),
|
||||
getString(C_SYS_NAME), starPoint.jumpCounter.plus(1), finishStarPoint.coords
|
||||
)
|
||||
sw2.start()
|
||||
if (closedList.notContains(newStarPoint)) {
|
||||
// openedList.addIfAbsent(newStarPoint)
|
||||
// openedList.smartAdd(newStarPoint)
|
||||
openedList.smartAdd2(newStarPoint)
|
||||
}
|
||||
sw2.stopWithConsoleOutput("Add to openList time: ")
|
||||
}
|
||||
}
|
||||
resultSet.close()
|
||||
stopwatch.stopWithConsoleOutput("Process time: ")
|
||||
}
|
||||
|
||||
private fun isNeutronDistance(isNeutron: Boolean) = if (isNeutron) NEUTRON_DISTANCE else USUAL_DISTANCE
|
||||
|
@ -32,14 +32,14 @@ class AStarMainFile {
|
||||
|
||||
findNeighbours(startStarPoint)
|
||||
|
||||
openedList.remove(startStarPoint)
|
||||
closedList.add(startStarPoint)
|
||||
|
||||
if (openedList.isEmpty()) {
|
||||
println("${consoleStringCounter()}Unable to complete task. No neighbors found near startStarPoint. =(")
|
||||
return
|
||||
}
|
||||
|
||||
openedList.remove(startStarPoint)
|
||||
closedList.add(startStarPoint)
|
||||
|
||||
do {
|
||||
|
||||
if (checkForFinish()) {
|
||||
@ -70,7 +70,7 @@ class AStarMainFile {
|
||||
|
||||
private fun findStarPointWithMinCost(): StarPoint {
|
||||
return openedList.minBy { starPoint -> starPoint.costF }!!.also { nextStarPoint ->
|
||||
println("Min cost star point: G = ${nextStarPoint.costG}, F = ${nextStarPoint.costF}, " +
|
||||
println("Min cost star point: G = ${nextStarPoint.costG}, F = ${nextStarPoint.costF}, H = ${nextStarPoint.costH} " +
|
||||
"dist = ${nextStarPoint.distance}, start = ${nextStarPoint.previousStarPoint == startStarPoint}")
|
||||
}
|
||||
}
|
||||
@ -125,19 +125,25 @@ class AStarMainFile {
|
||||
}
|
||||
|
||||
private fun printTheFoundPath(): Int {
|
||||
// val db = Database().apply { openConnection() }
|
||||
var starPoint = finishStarPoint.previousStarPoint!!
|
||||
var counter = 0
|
||||
var fullDistance = 0.0
|
||||
while (starPoint != startStarPoint) {
|
||||
// val systemName = db.query("select ${Database.C_SYS_NAME} FROM ${AStarMain.CORRIDOR} WHERE ${Database.C_ID64} = ${starPoint.systemId64}").let {
|
||||
// it.next()
|
||||
// it.getString(Database.C_SYS_NAME)
|
||||
// }
|
||||
println(
|
||||
"${consoleStringCounter()} Point $counter id = ${starPoint.systemId64}, " +
|
||||
// "name = ${starPoint.systemName} " +
|
||||
// "name = $systemName " +
|
||||
"distance = ${starPoint.distance}, G = ${starPoint.costG}, F = ${starPoint.costF}"
|
||||
)
|
||||
fullDistance += starPoint.distance
|
||||
starPoint = starPoint.previousStarPoint!!
|
||||
counter++
|
||||
}
|
||||
// db.closeDB()
|
||||
println("${consoleStringCounter()} Total jumps counter = $counter, distance = $fullDistance ly, replaces = $replaces, cof = ${StarPoint.NEUTRON_COF}")
|
||||
return counter
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user