Skip to content

Commit

Permalink
Bump Kotlin (2.0.21), jUnit (5.11.3), jUnit Platform (1.11.3), clikt …
Browse files Browse the repository at this point in the history
…(5.0.1)
  • Loading branch information
jfriemel committed Nov 8, 2024
1 parent c4976ce commit 8588c21
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 21 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
buildscript {
// Dependency versions
ext.badassRuntimeVersion="1.13.1"
ext.cliktVersion="5.0.0"
ext.cliktVersion="5.0.1"
ext.gdxVersion="1.12.1"
ext.jUnitPlatformVersion="1.11.0"
ext.jUnitVersion="5.11.0"
ext.jUnitPlatformVersion="1.11.3"
ext.jUnitVersion="5.11.3"
ext.klaxonVersion="5.6"
ext.kotlinCsvVersion="1.10.0"
ext.kotlinVersion="2.0.20"
ext.kotlinVersion="2.0.21"
ext.kotlinxCoroutinesVersion="1.9.0"
ext.ktxVersion="1.12.1-rc2"
ext.textraTypistVersion="1.1.0"
Expand Down
36 changes: 23 additions & 13 deletions core/src/main/kotlin/com/github/jfriemel/hybridsim/MainCLI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ data class CLIArguments(
val outputFile: File?,
)

class MainCLI(private val args: CLIArguments) {
class MainCLI(
private val args: CLIArguments,
) {
fun main() {
if (
args.algFile == null ||
Expand Down Expand Up @@ -61,7 +63,10 @@ class MainCLI(private val args: CLIArguments) {
Configuration.loadConfiguration(configJson)
val n = Configuration.tiles.keys.size
val k = Configuration.robots.keys.size
val m = Configuration.tiles.keys.minus(Configuration.targetNodes).size
val m =
Configuration.tiles.keys
.minus(Configuration.targetNodes)
.size
singleRun(id, n, k, m, args.limit, args.outputFile)
}
return
Expand All @@ -70,18 +75,23 @@ class MainCLI(private val args: CLIArguments) {
// Run algorithm on all configurations in specified configuration directory
var id = args.startID
if (args.configDir != null) {
args.configDir.listFiles()?.filter { file ->
file.toString().endsWith(".json")
}?.forEach { file ->
val configJson = file.readText()
repeat(args.numRuns) {
Configuration.loadConfiguration(configJson)
val n = Configuration.tiles.keys.size
val k = Configuration.robots.keys.size
val m = Configuration.tiles.keys.minus(Configuration.targetNodes).size
singleRun(id++, n, k, m, args.limit, args.outputFile)
args.configDir
.listFiles()
?.filter { file ->
file.toString().endsWith(".json")
}?.forEach { file ->
val configJson = file.readText()
repeat(args.numRuns) {
Configuration.loadConfiguration(configJson)
val n = Configuration.tiles.keys.size
val k = Configuration.robots.keys.size
val m =
Configuration.tiles.keys
.minus(Configuration.targetNodes)
.size
singleRun(id++, n, k, m, args.limit, args.outputFile)
}
}
}
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ data class GUIArguments(
val numOverhang: Int,
)

class MainGUI(private val args: GUIArguments) : KtxGame<KtxScreen>() {
class MainGUI(
private val args: GUIArguments,
) : KtxGame<KtxScreen>() {
override fun create() {
// Enable logging
Gdx.app.logLevel = Application.LOG_DEBUG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import java.time.LocalDateTime

private val logger = logger<InputHandler>()

class InputHandler(private val screen: SimScreen, private val menu: Menu) : KtxInputAdapter {
class InputHandler(
private val screen: SimScreen,
private val menu: Menu,
) : KtxInputAdapter {
private var mousePressed = false
private var mouseX = 0
private var mouseY = 0
Expand Down Expand Up @@ -65,7 +68,12 @@ class InputHandler(private val screen: SimScreen, private val menu: Menu) : KtxI

Input.Keys.F2 -> { // Take a screenshot
try {
val time = LocalDateTime.now().toString().split(".")[0].replace(':', '-')
val time =
LocalDateTime
.now()
.toString()
.split(".")[0]
.replace(':', '-')
val path = Paths.get(System.getProperty("user.dir"), "screenshots", "$time.png")
takeScreenshot(FileHandle(path.toFile()))
logger.debug { "Screenshot: $path" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ private val logger = logger<SimScreen>()

private const val INITIAL_ZOOM = 16f // Reasonable initial zoom level

class SimScreen(private val batch: Batch, private val menu: Menu) : KtxScreen {
class SimScreen(
private val batch: Batch,
private val menu: Menu,
) : KtxScreen {
// Squeeze factor to make the triangles equilateral (the texture is stretched horizontally)
private val xScale = sqrt(3f) / 2f

Expand Down

0 comments on commit 8588c21

Please sign in to comment.