PlayerHand test

This commit is contained in:
2025-03-05 17:49:53 +01:00
parent b6908cc712
commit 729e7f6adc
2 changed files with 54 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ package eventDemo.app.entity
typealias PlayerHands = Map<Player, List<Card>>
fun PlayerHands.addCard(
fun PlayerHands.removeCard(
player: Player,
card: Card,
) = mapValues { (p, cards) ->
@@ -12,3 +12,14 @@ fun PlayerHands.addCard(
cards
}
}
fun PlayerHands.addCards(
player: Player,
newCards: List<Card>,
) = mapValues { (p, cards) ->
if (p == player) {
cards + newCards
} else {
cards
}
}