diff --git a/src/main/kotlin/CountColors.kt b/src/main/kotlin/CountColors.kt index e0c71104..04028557 100644 --- a/src/main/kotlin/CountColors.kt +++ b/src/main/kotlin/CountColors.kt @@ -26,13 +26,15 @@ class CountColors(cards: Iterable) { operator fun plusAssign(cards: Iterable) = cards.forEach { plusAssign(it.colors) } operator fun plusAssign(card: Card) = plusAssign(card.colors) - operator fun plusAssign(colors: List) = colors.forEach { + operator fun plusAssign(colors: List) { if (colors.any { c -> c != Black }) trueCard++ - when (it) { - Black -> black++ - Red -> red++ - Blue -> blue++ - else -> {} + colors.forEach { + when (it) { + Black -> black++ + Red -> red++ + Blue -> blue++ + else -> {} + } } }