diff options
| -rw-r--r-- | go/game/pileOfCards.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/go/game/pileOfCards.go b/go/game/pileOfCards.go index c8b81c87..427bba47 100644 --- a/go/game/pileOfCards.go +++ b/go/game/pileOfCards.go @@ -1,8 +1,13 @@ package game +import ( + "golang.org/x/exp/slices" +) + type PileOfCards interface { Size() int IsEmpty() bool + Contains(*Card) bool Cards() []*Card AddCards(cards []*Card) AddCard(card *Card) @@ -27,6 +32,10 @@ func (poc *PileOfCardsBase) IsEmpty() bool { return poc.Size() == 0 } +func (poc *PileOfCardsBase) Contains(card *Card) bool { + return slices.Contains(poc.cards, card) +} + func (poc *PileOfCardsBase) Cards() []*Card { return poc.cards } |
