PlayerHand test
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user