tables

package module
v0.0.0-...-ad5d431 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MaxSplitHands = 3

Variables

This section is empty.

Functions

This section is empty.

Types

type Dealer

type Dealer struct {
	Hand           Hand
	DealerReport   DealerReport
	TimesHitSoft17 int64
	HitSoft17      bool
}

func NewDealer

func NewDealer(hitSoft17 bool) *Dealer

func (*Dealer) Draw

func (d *Dealer) Draw(c *cards.Card) *cards.Card

func (*Dealer) GetReport

func (d *Dealer) GetReport() *DealerReport

func (*Dealer) Play

func (d *Dealer) Play(s *cards.Shoe)

func (*Dealer) Reset

func (d *Dealer) Reset()

func (*Dealer) Stand

func (d *Dealer) Stand() bool

func (*Dealer) Statistics

func (d *Dealer) Statistics()

type DealerReport

type DealerReport struct {
	Hand           HandReport
	TimesHitSoft17 int64
}

type Hand

type Hand struct {
	Cards []cards.Card // Cards in the hand
	// contains filtered or unexported fields
}

func NewHand

func NewHand() *Hand

func (*Hand) Blackjack

func (h *Hand) Blackjack() bool

func (*Hand) Busted

func (h *Hand) Busted() bool

func (*Hand) Draw

func (h *Hand) Draw(c *cards.Card) *cards.Card

func (*Hand) Pair

func (h *Hand) Pair() bool

func (*Hand) PairOf

func (h *Hand) PairOf(r string) bool

func (*Hand) Reset

func (h *Hand) Reset()

func (*Hand) Soft

func (h *Hand) Soft() bool

func (*Hand) Soft17

func (h *Hand) Soft17() bool

func (*Hand) SplitPair

func (h *Hand) SplitPair() *cards.Card

func (*Hand) Total

func (h *Hand) Total() int

type HandReport

type HandReport struct {
	HandsDealt  int64
	Blackjacks  int64
	HandsPlayed int64
	HandsBusted int64
}

type PlayStrategy

type PlayStrategy struct {
	HardDouble map[int][]string
	SoftDouble map[int][]string
	PairSplit  map[int][]string
	HardStand  map[int][]string
	SoftStand  map[int][]string
}

type Player

type Player struct {
	TableRules   *database.TableRules
	PlayStrategy PlayStrategy
	Wager        Wager
	Splits       [MaxSplitHands]Wager

	PlayerReport PlayerReport
	// contains filtered or unexported fields
}

func NewPlayer

func NewPlayer(tr *database.TableRules, playStrategy *PlayStrategy, blackjackPays string) *Player

func (*Player) BustedOrBlackjack

func (p *Player) BustedOrBlackjack() bool

func (*Player) Draw

func (p *Player) Draw(c *cards.Card) *cards.Card

func (*Player) GetReport

func (p *Player) GetReport() *PlayerReport

func (*Player) Payoff

func (p *Player) Payoff(blackjack bool, busted bool, total int)

func (*Player) PlaceBet

func (p *Player) PlaceBet(b int)

func (*Player) Play

func (p *Player) Play(s *cards.Shoe, up *cards.Card)

func (*Player) PlaySplit

func (p *Player) PlaySplit(h *Wager, s *cards.Shoe, up *cards.Card)

type PlayerReport

type PlayerReport struct {
	Wager WagerReport
	Hand  HandReport
}

func NewPlayerReport

func NewPlayerReport() *PlayerReport

type SimulationReport

type SimulationReport struct {
	Name        string
	Code        string
	Start       time.Time
	End         time.Time
	Duration    time.Duration
	TableReport TableReport
}

type Table

type Table struct {
	Number           int
	Dealer           *Dealer
	Player           *Player
	Shoe             cards.Shoe
	TableRules       *database.TableRules
	SimulationReport SimulationReport
}

func NewTable

func NewTable(r *database.TableRules, p *Player, tableNumber, numberOfDecks int, penatration float64, name, code string) *Table

func (*Table) GetReport

func (t *Table) GetReport() *SimulationReport

func (*Table) Session

func (t *Table) Session(wg *sync.WaitGroup, numberOfRounds int)

type TableReport

type TableReport struct {
	NumberOfRounds     int64
	NumberOfHandsDealt int64
	TableRules         *database.TableRules
	BlackjackPays      string
	Penatration        float64
	ShoeReport         *cards.ShoeReport
	DealerReport       *DealerReport
	PlayerReport       *PlayerReport
}

type Wager

type Wager struct {
	Hand      Hand // The hand associated with the wager
	AmountBet int  // The amount of the initial bet
	DoubleBet int  // The amount of the double bet
	AmountWon int  // The amount won from the wager
}

func NewWager

func NewWager() *Wager

func (*Wager) Bet

func (w *Wager) Bet(b int)

func (*Wager) Blackjack

func (w *Wager) Blackjack() bool

func (*Wager) Double

func (w *Wager) Double()

func (*Wager) Lost

func (w *Wager) Lost()

func (*Wager) Reset

func (w *Wager) Reset()

func (*Wager) SplitWager

func (w *Wager) SplitWager(split *Wager)

func (*Wager) Won

func (w *Wager) Won()

func (*Wager) WonBlackjack

func (w *Wager) WonBlackjack(pays, bet int)

type WagerReport

type WagerReport struct {
	TotalBet  int64
	TotalWon  int64
	Advantage float64
}

Jump to

Keyboard shortcuts

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