summaryrefslogtreecommitdiff
path: root/sw-bot/src/main/kotlin/org/luxons
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2020-12-12 02:41:33 +0100
committerjoffrey-bion <joffrey.bion@gmail.com>2020-12-12 03:04:22 +0100
commitb4cb5e9ed50d1c94b78cd29485f37c5cd184bc9e (patch)
tree938ce933ff427a66fcf2ad0c1def93b554148596 /sw-bot/src/main/kotlin/org/luxons
parentAdd checks for race conditions (diff)
downloadseven-wonders-b4cb5e9ed50d1c94b78cd29485f37c5cd184bc9e.tar.gz
seven-wonders-b4cb5e9ed50d1c94b78cd29485f37c5cd184bc9e.tar.bz2
seven-wonders-b4cb5e9ed50d1c94b78cd29485f37c5cd184bc9e.zip
Delete game at the end of a game
Diffstat (limited to 'sw-bot/src/main/kotlin/org/luxons')
-rw-r--r--sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt5
1 files changed, 4 insertions, 1 deletions
diff --git a/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt b/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt
index 01106d21..87ba7983 100644
--- a/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt
+++ b/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt
@@ -44,7 +44,10 @@ class SevenWondersBot(
session.watchTurns()
.onStart { emit(firstTurn) }
.takeWhile { it.action != Action.WATCH_SCORE }
- .onCompletion { session.disconnect() }
+ .onCompletion {
+ session.leaveGame()
+ session.disconnect()
+ }
.collect { turn ->
botDelay()
session.playTurn(turn)
bgstack15