Skip to content

Commit

Permalink
Liar's Dice: Add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Jul 3, 2020
1 parent 83d5de7 commit fbdc55b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion games-core/src/main/kotlin/net/zomis/games/impl/LiarsDice.kt
Expand Up @@ -168,7 +168,9 @@ object LiarsDiceGame {
}

private fun logRevealAllDice(call: String, scope: ActionRuleScope<LiarsDice, *>) {
scope.log { "$player calls $call and everyone reveals their dice!" }
val bet = scope.game.bet!!
val actual = scope.game.players.sumBy { player -> player.dice.count { it == bet.second.value } }
scope.log { "$player calls $call on the bet ${bet.second.amount}x ${bet.second.value} by ${player(bet.first.index)} and everyone reveals their dice! (A total of $actual was revealed)" }
scope.game.players.filter { !it.eliminated }.forEach {
scope.log { "${player(it.index)} had ${it.dice.sorted().joinToString(", ")}" }
}
Expand Down

0 comments on commit fbdc55b

Please sign in to comment.