go-poker/hand.go

84 lines
1.8 KiB
Go
Raw Normal View History

package poker
2019-04-03 09:50:44 +00:00
2019-12-23 06:06:24 +00:00
import "errors"
2019-04-03 09:50:44 +00:00
type HEPokerHand struct {
2019-12-23 06:06:24 +00:00
HoleCards Cards
CommCardsNotUsed Cards
CommCardsUsed Cards
CommCardsAll Cards
HandScore HandScore
2019-04-03 09:50:44 +00:00
}
type HandScoreType uint8
type HandScoreRanking Rank
type HandScore struct {
2019-12-23 06:06:24 +00:00
Type HandScoreType
PrimaryRanking HandScoreRanking
SecondaryRanking HandScoreRanking
Kickers Cards
Description string
2019-04-03 09:50:44 +00:00
}
const (
HIGH_CARD HandScoreType = 0
ONE_PAIR HandScoreType = 1
TWO_PAIR HandScoreType = 2
SET HandScoreType = 3
STRAIGHT HandScoreType = 4
FLUSH HandScoreType = 5
FULL_HOUSE HandScoreType = 6
QUADS HandScoreType = 7
2019-04-03 09:50:44 +00:00
STRAIGHT_FLUSH HandScoreType = 8
)
func (self *HandScore) BeatsHand(v *HandScore) bool {
panic("not implemented")
2019-04-03 09:50:44 +00:00
}
func (self *HEPokerHand) IsPair() bool {
2019-12-23 06:06:24 +00:00
panic("not implemented")
return false
2019-04-03 09:50:44 +00:00
}
func (self *HEPokerHand) IsTwoPair() bool {
2019-12-23 06:06:24 +00:00
panic("not implemented")
return false
2019-04-03 09:50:44 +00:00
}
func (self *HEPokerHand) IsSet() bool {
2019-12-23 06:06:24 +00:00
panic("not implemented")
return false
2019-04-03 09:50:44 +00:00
}
func (self *HEPokerHand) IsStraight() bool {
2019-12-23 06:06:24 +00:00
panic("not implemented")
return false
2019-04-03 09:50:44 +00:00
}
func (self *HEPokerHand) IsFlush() bool {
2019-12-23 06:06:24 +00:00
panic("not implemented")
return false
2019-04-03 09:50:44 +00:00
}
func (self *HEPokerHand) IsFullHouse() bool {
2019-12-23 06:06:24 +00:00
panic("not implemented")
return false
2019-04-03 09:50:44 +00:00
}
2019-12-23 06:06:24 +00:00
// this takes a list of pointers to 5 or more cards, permutes them into every
// possible five-card hand, by removing each in turn and recursing to
// itself, and then returns the best one as an *HEPokerHand
// out of all possible five-card permutations.
func ScoreCardsForHoldEm(input *Cards) (*HEPokerHand, error) {
if len(*input) < 5 {
return nil, errors.New("need at least 5 cards for an HEPokerHand")
}
panic("not implemented")
2019-04-03 09:50:44 +00:00
}
2019-12-23 06:06:24 +00:00
func (self *HEPokerHand) ScoreHand() *HandScore {
return nil
}