Documentation ¶
Overview ¶
Copyright 2017 Andrew Medworth
This file is part of Gopoker, a set of miscellaneous poker-related functions written in the Go programming language (http://golang.org).
Gopoker is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Gopoker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Gopoker. If not, see <http://www.gnu.org/licenses/>.
Copyright 2013, 2015, 2017 Andrew Medworth ¶
This file is part of Gopoker, a set of miscellaneous poker-related functions written in the Go programming language (http://golang.org).
Gopoker is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Gopoker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Gopoker. If not, see <http://www.gnu.org/licenses/>.
Copyright 2017, 2020 Andrew Medworth ¶
This file is part of Gopoker, a set of miscellaneous poker-related functions written in the Go programming language (http://golang.org).
Gopoker is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Gopoker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Gopoker. If not, see <http://www.gnu.org/licenses/>.
Copyright 2013, 2015, 2017 Andrew Medworth ¶
This file is part of Gopoker, a set of miscellaneous poker-related functions written in the Go programming language (http://golang.org).
Gopoker is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Gopoker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Gopoker. If not, see <http://www.gnu.org/licenses/>.
Copyright 2013, 2015, 2017 Andrew Medworth ¶
This file is part of Gopoker, a set of miscellaneous poker-related functions written in the Go programming language (http://golang.org).
Gopoker is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Gopoker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Gopoker. If not, see <http://www.gnu.org/licenses/>.
Copyright 2017 Andrew Medworth ¶
This file is part of Gopoker, a set of miscellaneous poker-related functions written in the Go programming language (http://golang.org).
Gopoker is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Gopoker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Gopoker. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- func AllCardCombinations(pack []Card, numRequired int) [][]Card
- func Beats(h1 HandLevel, h2 HandLevel) bool
- func BeatsAceToFiveLow(l1, l2 HandLevel) bool
- func CardsEqual(c1, c2 []Card) bool
- func IsRankLess(rank1, rank2 Rank, aceLow bool) bool
- func PotOddsBreakEven(totalPotsWon float64, handCount int) float64
- func SortCards(cards []Card, aceLow bool)
- func TestAssertPotsWonSanity(winCount int, potsWon float64, description string, t *testing.T)
- func TestAssertSimSanity(sim *Simulator, players, simulations int, t *testing.T)
- func TestMakeHands(hands ...[]Card) [][]Card
- func TestPackPermutation(pack *Pack, t *testing.T)
- type Card
- type HandClass
- type HandLevel
- type HandOutcome
- type Pack
- type Rank
- type Simulator
- type Suit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllCardCombinations ¶
Compute all unique subsets of a set of cards, of a given size.
func Beats ¶
Compares two hands to see if one beats the other. All this needs to do is compare the levels; if they match, we compare the tiebreak ranks lexicographically.
func BeatsAceToFiveLow ¶
Determine whether one hand beats another using the ace-to-five low system.
func CardsEqual ¶
Check equality of sets of cards, ignoring ordering (mutates inputs)
func IsRankLess ¶
func PotOddsBreakEven ¶
Calculate the largest bet which would have a positive expected value, relative to the size of the pot.
func TestAssertPotsWonSanity ¶
func TestAssertSimSanity ¶
func TestMakeHands ¶
func TestPackPermutation ¶
Assert that the pack contains exactly one of every card
Types ¶
type Card ¶
func TestMakeHand ¶
type HandClass ¶
type HandClass int8
Classification of a poker hand (e.g. "straight flush"). For any two hands with different classifications, the higher-classified hand will always beat the lower.
type HandLevel ¶
The full information needed to determine whether one hand beats another. Tiebreak ranks are used to determine which hand wins if both are in the same class. For example, two full houses are compared first by the three-card set, then by the two-card set, so e.g. for threes-over-Jacks, the tiebreaks should be {Three,Jack}.
func ClassifyAceToFiveLow ¶
Ace-to-five low classification is very similar to standard classification - we just ignore straights and flushes.
func MinLevel ¶
func MinLevel() HandLevel
Function which returns a hand level beaten by any legitimate level
func TestMakeHandLevel ¶
func TestMakeHandLevels ¶
func (HandLevel) PrettyPrint ¶
func (HandLevel) PrettyTiebreaks ¶
type HandOutcome ¶
type Simulator ¶
type Simulator struct { Players int HandCount int WinCount int JointWinCount int BestOpponentWinCount int RandomOpponentWinCount int PotsWon float64 BestOpponentPotsWon float64 RandomOpponentPotsWon float64 OurClassCounts []int BestOpponentClassCounts []int RandomOpponentClassCounts []int ClassWinCounts []int ClassJointWinCounts []int ClassBestOppWinCounts []int ClassRandOppWinCounts []int BestHand HandLevel BestOppHand HandLevel ClassBestHands []HandLevel ClassBestOppHands []HandLevel }
func (*Simulator) PotOddsBreakEven ¶
func (*Simulator) ProcessHand ¶
func (s *Simulator) ProcessHand(outcome *HandOutcome)