Skip to content

Commit

Permalink
fix: adapt the tutorial to Alchemist 29
Browse files Browse the repository at this point in the history
  • Loading branch information
DanySK committed Dec 9, 2023
1 parent 21310d7 commit b004768
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 8 deletions.
17 changes: 14 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,22 @@ File(rootProject.rootDir.path + "/src/main/yaml").listFiles()
exportsDir.mkdirs()
}
}
args("-y", it.absolutePath, "-e", "$exportsDir/${it.nameWithoutExtension}-${System.currentTimeMillis()}")
args("run", it.absolutePath)
if (System.getenv("CI") == "true" || batch == "true") {
args("-hl", "-t", maxTime)
args(
"--override",
"""
{
launcher: { type: HeadlessSimulationLauncher, parameters: [] },
terminate: { type: AfterTime, parameters: 2 }
}
""".trimIndent()
)
} else {
args("-g", "effects/${it.nameWithoutExtension}.json")
args(
"--override",
"{ launcher: { parameters: { graphics: \"effects/${it.nameWithoutExtension}.json\" } } }"
)
}
outputs.dir(exportsDir)
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/yaml/00-minimal.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
incarnation: protelis

launcher:
type: SingleRunSwingUI

# An empty world
3 changes: 3 additions & 0 deletions src/main/yaml/01-nodes.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
incarnation: protelis

launcher:
type: SingleRunSwingUI

# Link nodes that are closer than 5 distance units
network-model:
type: ConnectWithinDistance
Expand Down
3 changes: 3 additions & 0 deletions src/main/yaml/02-manynodes.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
incarnation: protelis

launcher:
type: SingleRunSwingUI

# Link nodes separated by at most 0.5 space units
network-model:
type: ConnectWithinDistance
Expand Down
5 changes: 5 additions & 0 deletions src/main/yaml/03-grid.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
incarnation: protelis

launcher:
type: SingleRunSwingUI
parameters:
graphics: "effects/07-gradient"

network-model:
type: ConnectWithinDistance
parameters: [0.5]
Expand Down
3 changes: 3 additions & 0 deletions src/main/yaml/04-perturb-grid.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
incarnation: protelis

launcher:
type: SingleRunSwingUI

network-model:
type: ConnectWithinDistance
parameters: [0.5]
Expand Down
3 changes: 3 additions & 0 deletions src/main/yaml/05-content.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
incarnation: protelis

launcher:
type: SingleRunSwingUI

network-model:
type: ConnectWithinDistance
parameters: [0.5]
Expand Down
3 changes: 3 additions & 0 deletions src/main/yaml/06-program.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
incarnation: protelis

launcher:
type: SingleRunSwingUI

network-model:
type: ConnectWithinDistance
parameters: [0.5]
Expand Down
10 changes: 5 additions & 5 deletions src/test/kotlin/RunSimulationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.collections.beEmpty
import io.kotest.matchers.file.shouldHaveExtension
import io.kotest.matchers.shouldNot
import it.unibo.alchemist.core.implementations.Engine
import it.unibo.alchemist.core.interfaces.Status
import it.unibo.alchemist.loader.LoadAlchemist
import it.unibo.alchemist.model.implementations.positions.Euclidean2DPosition
import it.unibo.alchemist.boundary.LoadAlchemist
import it.unibo.alchemist.core.Engine
import it.unibo.alchemist.core.Status
import it.unibo.alchemist.model.positions.Euclidean2DPosition
import it.unibo.alchemist.model.times.DoubleTime
import java.io.File
import it.unibo.alchemist.model.implementations.times.DoubleTime
import java.util.concurrent.TimeUnit

class RunSimulationTest<T : Any?> : StringSpec(
Expand Down

0 comments on commit b004768

Please sign in to comment.