holdem

package
v0.0.0-...-13f8a94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NODE_CHANCE   = -1
	NODE_AI       = 0
	NODE_OPPONENT = 1
)
View Source
const (
	ACTION_FOLD   byte = 'f'
	ACTION_CALL   byte = 'c'
	ACTION_RAISE  byte = 'r'
	ACTION_ALL_IN byte = 'a'
)
View Source
const (
	ROYAL_PROB     = 0.000032
	STRFLUSH_PROB  = 0.000279
	FOURKIND_PROB  = 0.00168
	FULLH_PROB     = 0.026
	FLUSH_PROB     = 0.0303
	STRAIGHT_PROB  = 0.0462
	THREEKIND_PROB = 0.0483
	TWOPAIR_PROB   = 0.235
	ONEPAIR_PROB   = 0.438
	HCARD_PROB     = 0.174
)
View Source
const (
	SMALLBLIND_TRAIN int64 = 1
	CALL_TRAIN       int64 = 2
	ALLIN_TRAIN      int64 = 200
)

for training purposes

View Source
const (
	//This is for vs NEUTRAL AI fine tune
	FINETUNE_ON            bool    = true
	BLUFF                  bool    = false
	ALLIN_REDUCE           float64 = 0.8
	RAISE_REDUCE           float64 = 0.9
	RAISE_LIMIT_MULTIPLIER float64 = 80
	MONEY_TOO_BIG_PASS     float64 = 0.3
	FOLD_REDUCE            float64 = 0.9
	REPEATING_REDUCE       float64 = 0.5

	PREFLOP_HIGHPASS_CHECK float64 = 0.5
	PREFLOP_HIGHPASS_RAISE float64 = 0.9
	PREFLOP_HIGHPASS_ALLIN float64 = 0.9

	REPEATING_RESET_DISABLE bool = true
)

fine tune

View Source
const RAISE_SMALLEST_AMOUNT = 500

Variables

View Source
var Action Def.PlayerAction // 被通知的玩家能夠行動的方式(複合的Flag) / the move availble for current player?
View Source
var AllinBound float64 // 如果要Allin,則跟到標準後,只能再加這個數值
View Source
var ENC_OPPONENT = [2][]byte{
	{'I', 'J', 'K', 'L', '!'},
	{'k', 'l', 'm', '^'},
}

Encoding for remaining num of opponents + num of raises (H to u, some skipped)

View Source
var HAND_POTENTIAL = [10]byte{
	'0',
	'1',
	'2',
	'3',
	'4',
	'5',
	'6',
	'7',
	'8',
	'9',
}
View Source
var HAND_STRENGTH = [7]byte{
	'A',
	'B',
	'C',
	'D',
	'E',
	'F',
	'G',
}
View Source
var LOWER_BOUND = [2]int{4, 1}
View Source
var PROB_FLOP_DETAIL = [10][7]float64{
	{0.001258, 0.023501, 0.120919, 0.043026, 0.219528, 0.419889, 0.171879},
	{0.001560, 0.033909, 0.127559, 0.056606, 0.238955, 0.401088, 0.140323},
	{0.000109, 0.120814, 0.029908, 0.099367, 0.446634, 0.303168, 0.000000},
	{0.000162, 0.120814, 0.034382, 0.099087, 0.445545, 0.300010, 0.000000},
	{0.000355, 0.033909, 0.091614, 0.057559, 0.242643, 0.420957, 0.152963},
	{0.000674, 0.033909, 0.103119, 0.057318, 0.241712, 0.414887, 0.148381},
	{0.000128, 0.033909, 0.073241, 0.058264, 0.246075, 0.430919, 0.157463},
	{0.000165, 0.033909, 0.087417, 0.057996, 0.245031, 0.423656, 0.151825},
	{0.000132, 0.033909, 0.048020, 0.058972, 0.248822, 0.444644, 0.165501},
	{0.000161, 0.033909, 0.060566, 0.058725, 0.247864, 0.438231, 0.160544}}

new feature

View Source
var PROB_POSTFLOP = [4][7]float64{
	{0.0008, 0.0017, 0.0059, 0.0211, 0.0475, 0.4226, 0.5012},
	{0.000091, 0.00887, 0.0279, 0.036, 0.1244, 0.478, 0.325},
	{0.0003, 0.0277, 0.0765, 0.0483, 0.2350, 0.4380, 0.1740},
}
View Source
var PROB_PREFLOP = [10]float64{0.006, 0.012, 0.024, 0.054, 0.127, 0.109, 0.024, 0.048, 0.308, 0.288}
View Source
var PROB_RIVER_DETAIL = [7][7]float64{
	{1, 0, 0, 0, 0, 0, 0},
	{0, 1, 0, 0, 0, 0, 0},
	{0.003311, 0.000000, 0.996689, 0.000000, 0.000000, 0.000000, 0.000000},
	{0.000064, 0.217391, 0.014516, 0.768029, 0.000000, 0.000000, 0.000000},
	{0.000083, 0.088274, 0.016999, 0.000000, 0.894644, 0.000000, 0.000000},
	{0.000120, 0.000000, 0.040593, 0.043307, 0.258815, 0.657164, 0.000000},
	{0.000134, 0.000000, 0.073151, 0.013767, 0.082277, 0.385464, 0.541251}}
View Source
var PROB_TURN_DETAIL = [7][7]float64{
	{1, 0, 0, 0, 0, 0, 0},
	{0, 1, 0, 0, 0, 0, 0},
	{0.006720, 0.000000, 0.993280, 0.000000, 0.000000, 0.000000, 0.000000},
	{0.000055, 0.333950, 0.012354, 0.653642, 0.000000, 0.000000, 0.000000},
	{0.000073, 0.167438, 0.014919, 0.000000, 0.817570, 0.000000, 0.000000},
	{0.000199, 0.025902, 0.045818, 0.065364, 0.366782, 0.495935, 0.000000},
	{0.000280, 0.000000, 0.092060, 0.013767, 0.082277, 0.459604, 0.352012}}
View Source
var RaiseDiff float64 // 如果要加注,則跟到標準後,要大餘等於這個加注差值
View Source
var SeatIdx Def.SeatIndex // Seat index
View Source
var Standard float64 // 現在壓注的標準
View Source
var Total float64 // 現在壓注的總額
View Source
var UPPER_BOUND = [2]int{8, 3}

Functions

func AllInWinner

func AllInWinner(lastStrength string, remainingOpponent int) (winner byte)

only for training purposes 0 is lose, 1 is draw, 2 is win

func ArrangeCards

func ArrangeCards(mycard Def.Cards) Def.Cards

func ArrangeSlice

func ArrangeSlice(cardSlice []Def.Poker, size int)

func Checker

func Checker(mycard Def.Cards) string

func GenerateAllOpponentCard

func GenerateAllOpponentCard(myCard Def.Cards, remainingEnemy int, enemySlices []Def.Cards)

func GenerateOpponentCard

func GenerateOpponentCard(myCard Def.Cards) (opponentCard Def.Cards)

func GetCurrentRound

func GetCurrentRound(myCard Def.Cards) byte

func GetDecision

func GetDecision(Informations Def.RobotInherit, Standard, Total, RaiseDiff, AllInBound float64, myHistory string) (Def.PlayerAction, float64, string)

func GetOpponentInfo

func GetOpponentInfo(char byte) (int, int)

func GetRaiseAmount

func GetRaiseAmount(ConfidenceAmount, Standard, RaiseDiff, AllInBound float64, Informations Def.RobotInherit) float64

func GetStrategy

func GetStrategy(history string) []float64

func HistoryAdd

func HistoryAdd(mycard Def.Cards) string

func OpponentRaiseDecoding

func OpponentRaiseDecoding(ltr string) (intAmount int64)

func OpponentRaiseEncoding

func OpponentRaiseEncoding(rp, raiseNum int) (res string)

func PseudoGeneratorForMyRaise

func PseudoGeneratorForMyRaise(ConfidenceAmount float64, Standard, RaiseDiff, AllInBound, SbBet, ContestMoney, BetPos int64) int64

func PseudoGeneratorForOpponentAllIn

func PseudoGeneratorForOpponentAllIn(totalMoney int64) int64

func PseudoGeneratorForOpponentRaise

func PseudoGeneratorForOpponentRaise(ConfidenceAmount float64, RaiseDiff, Standard, AllInBound int64) (returnVar int64)

for training purposes

func RewardCounter

func RewardCounter(history string, raiseHistory []float64, raiseSize int64) (Total, BetPos int64)

Types

type PokerNode

type PokerNode struct {
	// contains filtered or unexported fields
}

PokerNode implements cfr.GameTreeNode for Kuhn Poker.

func NewGame

func NewGame(p *cfr.PolicyTable) *PokerNode

func (*PokerNode) Close

func (k *PokerNode) Close()

Close implements cfr.GameTreeNode.

func (*PokerNode) GetChild

func (k *PokerNode) GetChild(i int) cfr.GameTreeNode

GetChild implements cfr.GameTreeNode.

func (*PokerNode) GetChildProbability

func (k *PokerNode) GetChildProbability(i int) float64

GetChildProbability implements cfr.GameTreeNode.

func (*PokerNode) GetNode

func (k *PokerNode) GetNode(history string) cfr.GameTreeNode

cfr.GameTreeNode implementation

func (PokerNode) GetProb

func (k PokerNode) GetProb() []float64

Get functions

func (*PokerNode) InfoSet

func (k *PokerNode) InfoSet(player int) cfr.InfoSet

InfoSet implements cfr.GameTreeNode.

func (*PokerNode) InfoSetKey

func (k *PokerNode) InfoSetKey(player int) []byte

func (*PokerNode) IsTerminal

func (k *PokerNode) IsTerminal() bool

func (*PokerNode) NumChildren

func (k *PokerNode) NumChildren() int

NumChildren implements cfr.GameTreeNode.

func (*PokerNode) Parent

func (k *PokerNode) Parent() cfr.GameTreeNode

Parent implements cfr.GameTreeNode.

func (*PokerNode) Player

func (k *PokerNode) Player() int

Player implements cfr.GameTreeNode.

func (*PokerNode) SampleChild

func (k *PokerNode) SampleChild() (cfr.GameTreeNode, float64)

SampleChild implements cfr.GameTreeNode.

func (PokerNode) String

func (k PokerNode) String() string

String implements fmt.Stringer.

func (*PokerNode) Type

func (k *PokerNode) Type() cfr.NodeType

Type implements cfr.GameTreeNode.

func (*PokerNode) Utility

func (k *PokerNode) Utility(player int) float64

Utility implements cfr.GameTreeNode.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL