Skip to content

Commit

Permalink
修复算分错误(fix #300)
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Sep 25, 2024
1 parent bdeedc2 commit aee4784
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/kotlin/CountColors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ class CountColors(cards: Iterable<Card>) {

operator fun plusAssign(cards: Iterable<Card>) = cards.forEach { plusAssign(it.colors) }
operator fun plusAssign(card: Card) = plusAssign(card.colors)
operator fun plusAssign(colors: List<color>) = colors.forEach {
operator fun plusAssign(colors: List<color>) {
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 -> {}
}
}
}

Expand Down

0 comments on commit aee4784

Please sign in to comment.