From cf29a354b480b9cb027909ac41b4972ba4bc6293 Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Fri, 27 Nov 2020 02:14:39 +0100 Subject: Switch max/min to maxOrNull/minOrNull --- .../src/main/kotlin/org/luxons/sevenwonders/engine/boards/Science.kt | 2 +- sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Hands.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sw-engine/src') diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Science.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Science.kt index 992f4079..681f1c27 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Science.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Science.kt @@ -50,7 +50,7 @@ internal class Science { private fun computePointsNoJoker(values: List): Int { val independentSquaresSum = values.sumBy { it * it } - val nbGroupsOfAll = values.min() ?: 0 + val nbGroupsOfAll = values.minOrNull() ?: 0 return independentSquaresSum + nbGroupsOfAll * 7 } } diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Hands.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Hands.kt index b024848d..9bb1e6f8 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Hands.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Hands.kt @@ -35,5 +35,5 @@ internal class Hands(private val hands: List>) { return Hands(newHands) } - fun maxOneCardRemains(): Boolean = hands.map { it.size }.max() ?: 0 <= 1 + fun maxOneCardRemains(): Boolean = hands.map { it.size }.maxOrNull() ?: 0 <= 1 } -- cgit