diff options
author | joffrey-bion <joffrey.bion@gmail.com> | 2021-02-03 02:37:38 +0100 |
---|---|---|
committer | joffrey-bion <joffrey.bion@gmail.com> | 2021-02-03 23:29:16 +0100 |
commit | 7c2371766b940742f3986d7904d4c20a4127ea70 (patch) | |
tree | 294d0c80b2590b69d032a37bcc78b3ce15be012a /sw-common-model/src | |
parent | Cleanup (diff) | |
download | seven-wonders-7c2371766b940742f3986d7904d4c20a4127ea70.tar.gz seven-wonders-7c2371766b940742f3986d7904d4c20a4127ea70.tar.bz2 seven-wonders-7c2371766b940742f3986d7904d4c20a4127ea70.zip |
Add auto-game with bots only
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/82
Diffstat (limited to 'sw-common-model/src')
3 files changed, 40 insertions, 1 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/AutoGame.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/AutoGame.kt new file mode 100644 index 00000000..9822b303 --- /dev/null +++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/AutoGame.kt @@ -0,0 +1,27 @@ +package org.luxons.sevenwonders.model.api + +import kotlinx.serialization.Serializable +import org.luxons.sevenwonders.model.Settings +import org.luxons.sevenwonders.model.TableState +import org.luxons.sevenwonders.model.api.actions.BotConfig +import org.luxons.sevenwonders.model.score.ScoreBoard +import org.luxons.sevenwonders.model.wonders.AssignedWonder +import kotlin.random.Random + +@Serializable +data class AutoGameAction( + val nbPlayers: Int = 3, + val gameName: String = "AutoGame-${Random.nextInt().toString(16)}", + val customSettings: Settings? = null, + val customWonders: List<AssignedWonder>? = null, + /** + * The configuration of the bots that will play the game. + */ + val config: BotConfig = BotConfig(0, 0), +) + +@Serializable +data class AutoGameResult( + val scoreBoard: ScoreBoard, + val table: TableState, +) diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Player.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Player.kt index 3963112a..8ed15f24 100644 --- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Player.kt +++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Player.kt @@ -17,7 +17,9 @@ data class ConnectedPlayer( override val displayName: String, override val isHuman: Boolean, override val icon: Icon?, -) : BasicPlayerInfo +) : BasicPlayerInfo { + override fun toString(): String = "'$displayName' ($username)" +} @Serializable data class PlayerDTO( diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/actions/Actions.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/actions/Actions.kt index b0be3ae0..8d352402 100644 --- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/actions/Actions.kt +++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/actions/Actions.kt @@ -106,4 +106,14 @@ class AddBotAction( * The display name for the bot to add. */ val botDisplayName: String, + /** + * The configuration of the bot to add. + */ + val config: BotConfig = BotConfig(), +) + +@Serializable +data class BotConfig( + val minActionDelayMillis: Long = 50, + val maxActionDelayMillis: Long = 500, ) |