aboutsummaryrefslogtreecommitdiff
path: root/go/game/hand.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/game/hand.go')
-rw-r--r--go/game/hand.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/go/game/hand.go b/go/game/hand.go
index fde4a686..169c8cb3 100644
--- a/go/game/hand.go
+++ b/go/game/hand.go
@@ -22,11 +22,14 @@ func (h *Hand) AddCard(card *Card) {
}
func (h *Hand) RemoveCard(card *Card) {
+ ncards := len(h.Cards)
for i, c := range h.Cards {
if c != card {
continue
}
- h.Cards = append(h.Cards[:i], h.Cards[i+1:]...)
+ h.Cards[i] = h.Cards[ncards-1]
+ h.Cards = h.Cards[:ncards-1]
+ return
}
}