36 lines
950 B
Go
36 lines
950 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.eeqj.de/sneak/pokercore"
|
|
)
|
|
|
|
func main() {
|
|
d := pokercore.NewDeck()
|
|
fmt.Printf("deck before shuffling: %s\n", d.FormatForTerminal())
|
|
d.ShuffleDeterministically(1337 + 1) // 1337 gives too weird a result
|
|
fmt.Printf("deck after shuffling: %s\n", d.FormatForTerminal())
|
|
var players []pokercore.Cards
|
|
for i := 0; i < 6; i++ {
|
|
players = append(players, d.Deal(2))
|
|
}
|
|
for i, p := range players {
|
|
fmt.Printf("player %d: %s\n", i, p.FormatForTerminal())
|
|
}
|
|
// deal the flop
|
|
var community pokercore.Cards
|
|
community = d.Deal(3)
|
|
fmt.Printf("flop: %s\n", community.FormatForTerminal())
|
|
// evaluate the hands so far
|
|
for i, p := range players {
|
|
fmt.Printf("player %d: %s\n", i, p.FormatForTerminal())
|
|
thisPlayersHand, err := p.Append(community).PokerHand()
|
|
if err != nil {
|
|
fmt.Printf("error evaluating hand: %s\n", err)
|
|
continue
|
|
}
|
|
fmt.Printf("player %d: %s\n", i, thisPlayersHand.String())
|
|
}
|
|
}
|