Move to entity structs
This commit is contained in:
17
src/entity/hand.go
Normal file
17
src/entity/hand.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package entity
|
||||
|
||||
type Hand struct {
|
||||
Public []Card
|
||||
Private []Card
|
||||
}
|
||||
|
||||
func (hand *Hand) Push(card Card) {
|
||||
if hand.Public == nil {
|
||||
hand.Public = make([]Card, 0, 1)
|
||||
}
|
||||
hand.Public = append(hand.Public, card)
|
||||
}
|
||||
|
||||
func (hand Hand) Len() int {
|
||||
return len(hand.Public) + len(hand.Private)
|
||||
}
|
||||
Reference in New Issue
Block a user