From daa52b9f3c4e1fc496dccd65ecca6158f1f2768f Mon Sep 17 00:00:00 2001 From: Jeffrey Paul Date: Wed, 3 Apr 2019 02:50:44 -0700 Subject: [PATCH] this doesn't work yet, just saving --- pokercore/pokercore.go | 40 -------------------------- pokercore/pokerhand.go | 65 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 40 deletions(-) create mode 100644 pokercore/pokerhand.go diff --git a/pokercore/pokercore.go b/pokercore/pokercore.go index 6512924..c2f7bb3 100644 --- a/pokercore/pokercore.go +++ b/pokercore/pokercore.go @@ -190,43 +190,3 @@ func proto() { fmt.Printf("community: %s\n", cmty) } -func scorePokerHand(input Cards) (score int) { - /* - - scoring system: - high card: - high card * 14^4 - + first kicker * 14^3 - + second kicker * 14^2 - + third kicker * 14 - + fourth kicker - max(AKQJ9): 576,011 - single pair: - pair value * 1,000,000 - + first kicker * 14^2 - + second kicker * 14 - + third kicker - max(AAKQJ): 14,002,727 - two pair: - higher of the two pair value * 100,000,000 - + lower of the two pair value * 14 - + kicker value - max(AAKKQ): 1,300,000,179 - trips: - trips value * 1,000,000,000 (min 2,000,000,000) - + first kicker * 14 - + second kicker - max (AAAKQ): 14,000,000,194 - straight: - highest card * 10,000,000,000 - straight to the ace: 140,000,000,000 - flush: - highest card * 100,000,000,000 - min(23457): 700,000,000,000 - max(AXXXX): 1,400,000,000,000 - boat: - - - */ - return 1 -} diff --git a/pokercore/pokerhand.go b/pokercore/pokerhand.go new file mode 100644 index 0000000..e29f5c6 --- /dev/null +++ b/pokercore/pokerhand.go @@ -0,0 +1,65 @@ +package pokercore + +type HEPokerHand struct { + Cards Cards + HandScore HandScore +} + +type HandScoreType uint8 +type HandScoreRanking Rank + +type HandScore struct { + Type HandScoreType + Ranking HandScoreRanking + Kickers Cards + Description string +} + +const ( + HIGH_CARD HandScoreType = 0 + ONE_PAIR HandScoreType = 1 + TWO_PAIR HandScoreType = 2 + SET HandScoreType = 3 + STRAIGHT HandScoreType = 4 + FLUSH HandScoreType = 5 + BOAT HandScoreType = 6 + QUADS HandScoreType = 7 + STRAIGHT_FLUSH HandScoreType = 8 +) + +func (self *HandScore) BeatsHand(v *HandScore) bool { + +} + +func (self *HEPokerHand) IsReducedYet() bool { + if len(self.Cards) == 5 { + return true + } + return false +} + +func (self *HEPokerHand) IsPair() bool { +} + +func (self *HEPokerHand) IsTwoPair() bool { +} + +func (self *HEPokerHand) IsSet() bool { +} + +func (self *HEPokerHand) IsStraight() bool { +} + +func (self *HEPokerHand) IsFlush() bool { +} + +func (self *HEPokerHand) IsBoat() bool { +} + +func (self *HEPokerHand) ScoreHand() *HandScore { + +} + +func scoreHEPokerHand(input Cards) (hand HEPokerHand) { + return 1 +} \ No newline at end of file