still doesn't work, but is moving in the right direction
This commit is contained in:
parent
daa52b9f3c
commit
5289841027
|
@ -189,4 +189,3 @@ func proto() {
|
||||||
cmty := myDeck.Deal(5)
|
cmty := myDeck.Deal(5)
|
||||||
fmt.Printf("community: %s\n", cmty)
|
fmt.Printf("community: %s\n", cmty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
package pokercore
|
package pokercore
|
||||||
|
|
||||||
type HEPokerHand struct {
|
type HEPokerHand struct {
|
||||||
Cards Cards
|
Cards Cards
|
||||||
HandScore HandScore
|
HandScore HandScore
|
||||||
}
|
}
|
||||||
|
|
||||||
type HandScoreType uint8
|
type HandScoreType uint8
|
||||||
type HandScoreRanking Rank
|
type HandScoreRanking Rank
|
||||||
|
|
||||||
type HandScore struct {
|
type HandScore struct {
|
||||||
Type HandScoreType
|
Type HandScoreType
|
||||||
Ranking HandScoreRanking
|
Ranking HandScoreRanking
|
||||||
Kickers Cards
|
Kickers Cards
|
||||||
Description string
|
Description string
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
HIGH_CARD HandScoreType = 0
|
HIGH_CARD HandScoreType = 0
|
||||||
ONE_PAIR HandScoreType = 1
|
ONE_PAIR HandScoreType = 1
|
||||||
TWO_PAIR HandScoreType = 2
|
TWO_PAIR HandScoreType = 2
|
||||||
SET HandScoreType = 3
|
SET HandScoreType = 3
|
||||||
STRAIGHT HandScoreType = 4
|
STRAIGHT HandScoreType = 4
|
||||||
FLUSH HandScoreType = 5
|
FLUSH HandScoreType = 5
|
||||||
BOAT HandScoreType = 6
|
FULL_HOUSE HandScoreType = 6
|
||||||
QUADS HandScoreType = 7
|
QUADS HandScoreType = 7
|
||||||
STRAIGHT_FLUSH HandScoreType = 8
|
STRAIGHT_FLUSH HandScoreType = 8
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,10 +32,10 @@ func (self *HandScore) BeatsHand(v *HandScore) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *HEPokerHand) IsReducedYet() bool {
|
func (self *HEPokerHand) IsReducedYet() bool {
|
||||||
if len(self.Cards) == 5 {
|
if len(self.Cards) == 5 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *HEPokerHand) IsPair() bool {
|
func (self *HEPokerHand) IsPair() bool {
|
||||||
|
@ -60,6 +60,11 @@ func (self *HEPokerHand) ScoreHand() *HandScore {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func scoreHEPokerHand(input Cards) (hand HEPokerHand) {
|
func scoreHEPokerHand(input Cards) *HEPokerHand {
|
||||||
|
// this takes a list of pointers to 7 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.
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue