Documentation
¶
Index ¶
- Variables
- func BruteForce3x(ctx context.Context, s Stater, g SlotGame, reels Reels)
- func BruteForce5x(ctx context.Context, s Stater, g SlotGame, reels Reels)
- func BruteForce5xGo(ctx context.Context, s Stater, g SlotGame, reels Reels)
- func FindReels[T any](reelsmap map[float64]T, mrtp float64) (rtp float64, reels T)
- func MonteCarlo(ctx context.Context, s Stater, g SlotGame, reels Reels)
- func MonteCarloGo(ctx context.Context, s Stater, g SlotGame, reels Reels)
- func ScanReels(ctx context.Context, s Stater, g SlotGame, reels Reels, ...) time.Duration
- type Bitset
- type Linex
- func (l *Linex) At(x Pos) Pos
- func (l *Linex) Copy(pos, num Pos) (dst Linex)
- func (l *Linex) CopyL(num Pos) (dst Linex)
- func (l *Linex) CopyR5(num Pos) (dst Linex)
- func (l *Linex) Cover(op Linex) *Linex
- func (l *Linex) Len() int
- func (l Linex) MarshalJSON() ([]byte, error)
- func (l *Linex) Set(x Pos, val Pos)
- type Pos
- type Reels
- type Reels3x
- type Reels5x
- type Screen
- type Screen3x3
- func (s *Screen3x3) At(x, y Pos) Sym
- func (s *Screen3x3) Dim() (Pos, Pos)
- func (s *Screen3x3) FillSym() Sym
- func (s *Screen3x3) Free()
- func (s *Screen3x3) Pos(x Pos, line Linex) Sym
- func (s *Screen3x3) ScatNum(scat Sym) (n Pos)
- func (s *Screen3x3) ScatNumCont(scat Sym) (n Pos)
- func (s *Screen3x3) ScatNumOdd(scat Sym) (n Pos)
- func (s *Screen3x3) ScatPos(scat Sym) (l Linex)
- func (s *Screen3x3) ScatPosCont(scat Sym) (l Linex)
- func (s *Screen3x3) ScatPosOdd(scat Sym) (l Linex)
- func (s *Screen3x3) Set(x, y Pos, sym Sym)
- func (s *Screen3x3) SetCol(x Pos, reel []Sym, pos int)
- func (s *Screen3x3) Spin(reels Reels)
- type Screen5x3
- func (s *Screen5x3) At(x, y Pos) Sym
- func (s *Screen5x3) Dim() (Pos, Pos)
- func (s *Screen5x3) FillSym() Sym
- func (s *Screen5x3) Free()
- func (s *Screen5x3) Pos(x Pos, line Linex) Sym
- func (s *Screen5x3) ScatNum(scat Sym) (n Pos)
- func (s *Screen5x3) ScatNumCont(scat Sym) (n Pos)
- func (s *Screen5x3) ScatNumOdd(scat Sym) (n Pos)
- func (s *Screen5x3) ScatPos(scat Sym) (l Linex)
- func (s *Screen5x3) ScatPosCont(scat Sym) (l Linex)
- func (s *Screen5x3) ScatPosOdd(scat Sym) (l Linex)
- func (s *Screen5x3) Set(x, y Pos, sym Sym)
- func (s *Screen5x3) SetCol(x Pos, reel []Sym, pos int)
- func (s *Screen5x3) Spin(reels Reels)
- type Screen5x4
- func (s *Screen5x4) At(x, y Pos) Sym
- func (s *Screen5x4) Dim() (Pos, Pos)
- func (s *Screen5x4) FillSym() Sym
- func (s *Screen5x4) Free()
- func (s *Screen5x4) Pos(x Pos, line Linex) Sym
- func (s *Screen5x4) ScatNum(scat Sym) (n Pos)
- func (s *Screen5x4) ScatNumCont(scat Sym) (n Pos)
- func (s *Screen5x4) ScatNumOdd(scat Sym) (n Pos)
- func (s *Screen5x4) ScatPos(scat Sym) (l Linex)
- func (s *Screen5x4) ScatPosCont(scat Sym) (l Linex)
- func (s *Screen5x4) ScatPosOdd(scat Sym) (l Linex)
- func (s *Screen5x4) Set(x, y Pos, sym Sym)
- func (s *Screen5x4) SetCol(x Pos, reel []Sym, pos int)
- func (s *Screen5x4) Spin(reels Reels)
- type Screenx
- func (s *Screenx) At(x, y Pos) Sym
- func (s *Screenx) Dim() (Pos, Pos)
- func (s *Screenx) FillSym() (sym Sym)
- func (s *Screenx) Free()
- func (s *Screenx) Len() int
- func (s *Screenx) MarshalJSON() ([]byte, error)
- func (s *Screenx) Pos(x Pos, line Linex) Sym
- func (s *Screenx) ScatNum(scat Sym) (n Pos)
- func (s *Screenx) ScatNumCont(scat Sym) (n Pos)
- func (s *Screenx) ScatNumOdd(scat Sym) (n Pos)
- func (s *Screenx) ScatPos(scat Sym) (l Linex)
- func (s *Screenx) ScatPosCont(scat Sym) (l Linex)
- func (s *Screenx) ScatPosOdd(scat Sym) (l Linex)
- func (s *Screenx) Set(x, y Pos, sym Sym)
- func (s *Screenx) SetCol(x Pos, reel []Sym, pos int)
- func (s *Screenx) Spin(reels Reels)
- func (s *Screenx) UnmarshalJSON(b []byte) (err error)
- func (s *Screenx) UpdateDim() (sx, sy Pos)
- type Slot3x3
- func (g *Slot3x3) Apply(screen Screen, wins Wins)
- func (g *Slot3x3) FreeSpins() int
- func (g *Slot3x3) GetBet() float64
- func (g *Slot3x3) GetGain() float64
- func (g *Slot3x3) GetSel() Bitset
- func (g *Slot3x3) NewScreen() Screen
- func (g *Slot3x3) SetBet(bet float64) error
- func (g *Slot3x3) SetGain(gain float64) error
- func (g *Slot3x3) Spawn(screen Screen, wins Wins)
- type Slot5x3
- func (g *Slot5x3) Apply(screen Screen, wins Wins)
- func (g *Slot5x3) FreeSpins() int
- func (g *Slot5x3) GetBet() float64
- func (g *Slot5x3) GetGain() float64
- func (g *Slot5x3) GetSel() Bitset
- func (g *Slot5x3) NewScreen() Screen
- func (g *Slot5x3) SetBet(bet float64) error
- func (g *Slot5x3) SetGain(gain float64) error
- func (g *Slot5x3) Spawn(screen Screen, wins Wins)
- type Slot5x4
- func (g *Slot5x4) Apply(screen Screen, wins Wins)
- func (g *Slot5x4) FreeSpins() int
- func (g *Slot5x4) GetBet() float64
- func (g *Slot5x4) GetGain() float64
- func (g *Slot5x4) GetSel() Bitset
- func (g *Slot5x4) NewScreen() Screen
- func (g *Slot5x4) SetBet(bet float64) error
- func (g *Slot5x4) SetGain(gain float64) error
- func (g *Slot5x4) Spawn(screen Screen, wins Wins)
- type SlotGame
- type Stat
- type Stater
- type Sym
- type WinItem
- type Wins
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoWay = errors.New("no way to here") ErrBetEmpty = errors.New("bet is empty") ErrNoLineset = errors.New("lines set is empty") ErrLinesetOut = errors.New("lines set is out of range bet lines") ErrNoFeature = errors.New("feature not available") )
var BetLinesBetSoft25 = []Linex{
{2, 2, 2, 2, 2},
{1, 1, 1, 1, 1},
{3, 3, 3, 3, 3},
{1, 2, 3, 2, 1},
{3, 2, 1, 2, 3},
{1, 1, 2, 1, 1},
{3, 3, 2, 3, 3},
{2, 3, 3, 3, 2},
{2, 1, 1, 1, 2},
{2, 1, 2, 1, 2},
{2, 3, 2, 3, 2},
{1, 2, 1, 2, 1},
{3, 2, 3, 2, 3},
{2, 2, 1, 2, 2},
{2, 2, 3, 2, 2},
{1, 2, 2, 2, 1},
{3, 2, 2, 2, 3},
{1, 2, 3, 3, 3},
{3, 2, 1, 1, 1},
{1, 3, 1, 3, 1},
{3, 1, 3, 1, 3},
{1, 3, 3, 3, 1},
{3, 1, 1, 1, 3},
{1, 1, 3, 1, 1},
{3, 3, 1, 3, 3},
}
BetSoft 25 bet lines
var BetLinesBetSoft30 = []Linex{
{2, 2, 2, 2, 2},
{1, 1, 1, 1, 1},
{3, 3, 3, 3, 3},
{1, 2, 3, 2, 1},
{3, 2, 1, 2, 3},
{1, 1, 2, 1, 1},
{3, 3, 2, 3, 3},
{2, 3, 3, 3, 2},
{2, 1, 1, 1, 2},
{2, 1, 2, 1, 2},
{2, 3, 2, 3, 2},
{1, 2, 1, 2, 1},
{3, 2, 3, 2, 3},
{2, 2, 1, 2, 2},
{2, 2, 3, 2, 2},
{1, 2, 2, 2, 1},
{3, 2, 2, 2, 3},
{1, 2, 3, 3, 3},
{3, 2, 1, 1, 1},
{1, 3, 1, 3, 1},
{3, 1, 3, 1, 3},
{1, 3, 3, 3, 1},
{3, 1, 1, 1, 3},
{1, 1, 3, 1, 1},
{3, 3, 1, 3, 3},
{1, 3, 2, 1, 3},
{3, 1, 2, 3, 1},
{2, 1, 3, 2, 3},
{1, 3, 2, 3, 2},
{3, 2, 1, 1, 2},
}
BetSoft 30 bet lines
var BetLinesHot3 = []Linex{
{2, 2, 2},
{1, 1, 1},
{3, 3, 3},
{1, 2, 3},
{3, 2, 1},
}
Ultra Hot 3x3 bet lines
var BetLinesMgj = []Linex{
{2, 2, 2, 2, 2},
{1, 1, 1, 1, 1},
{3, 3, 3, 3, 3},
{1, 2, 3, 2, 1},
{3, 2, 1, 2, 3},
{1, 1, 2, 3, 3},
{3, 3, 2, 1, 1},
{2, 1, 2, 3, 2},
{2, 3, 2, 1, 2},
{1, 2, 1, 2, 1},
{3, 2, 3, 2, 3},
{1, 2, 2, 2, 2},
{3, 2, 2, 2, 2},
{2, 2, 1, 1, 1},
{2, 2, 3, 3, 3},
{2, 1, 1, 1, 1},
{2, 3, 3, 3, 3},
{1, 1, 1, 1, 2},
{3, 3, 3, 3, 2},
{3, 3, 2, 3, 3},
{1, 1, 2, 1, 1},
}
Megajack 21 bet lines
var BetLinesNetEnt10 = []Linex{
{2, 2, 2, 2, 2},
{1, 1, 1, 1, 1},
{3, 3, 3, 3, 3},
{1, 2, 3, 2, 1},
{3, 2, 1, 2, 3},
{1, 1, 2, 1, 1},
{3, 3, 2, 3, 3},
{2, 3, 3, 3, 2},
{2, 1, 1, 1, 2},
{2, 1, 2, 1, 2},
}
NetEnt 10 bet lines
var BetLinesNetEnt20 = []Linex{
{2, 2, 2, 2, 2},
{1, 1, 1, 1, 1},
{3, 3, 3, 3, 3},
{1, 2, 3, 2, 1},
{3, 2, 1, 2, 3},
{1, 1, 2, 1, 1},
{3, 3, 2, 3, 3},
{2, 3, 3, 3, 2},
{2, 1, 1, 1, 2},
{2, 1, 2, 1, 2},
{2, 3, 2, 3, 2},
{1, 2, 1, 2, 1},
{3, 2, 3, 2, 3},
{2, 2, 1, 2, 2},
{2, 2, 3, 2, 2},
{1, 2, 2, 2, 1},
{3, 2, 2, 2, 3},
{1, 2, 3, 3, 3},
{3, 2, 1, 1, 1},
{1, 3, 1, 3, 1},
}
NetEnt 20 bet lines
var BetLinesNvm10 = []Linex{
{2, 2, 2, 2, 2},
{1, 1, 1, 1, 1},
{3, 3, 3, 3, 3},
{1, 2, 3, 2, 1},
{3, 2, 1, 2, 3},
{2, 3, 3, 3, 2},
{2, 1, 1, 1, 2},
{3, 3, 2, 1, 1},
{1, 1, 2, 3, 3},
{3, 2, 2, 2, 1},
}
Novomatic 10 bet lines (deluxe versions of games)
var BetLinesNvm20 = []Linex{
{2, 2, 2, 2, 2},
{1, 1, 1, 1, 1},
{3, 3, 3, 3, 3},
{1, 2, 3, 2, 1},
{3, 2, 1, 2, 3},
{1, 1, 2, 3, 3},
{3, 3, 2, 1, 1},
{2, 1, 1, 1, 2},
{2, 3, 3, 3, 2},
{1, 2, 2, 2, 1},
{3, 2, 2, 2, 3},
{2, 1, 2, 3, 2},
{2, 3, 2, 1, 2},
{1, 3, 1, 3, 1},
{3, 1, 3, 1, 3},
{1, 2, 1, 2, 1},
{3, 2, 3, 2, 3},
{1, 3, 3, 3, 3},
{3, 1, 1, 1, 1},
{2, 2, 1, 2, 2},
}
Novomatic 20 bet lines (new games)
var BetLinesNvm40 = []Linex{
{1, 1, 1, 1, 1},
{2, 2, 2, 2, 2},
{3, 3, 3, 3, 3},
{4, 4, 4, 4, 4},
{1, 2, 3, 2, 1},
{2, 3, 4, 3, 2},
{3, 2, 1, 2, 3},
{4, 3, 2, 3, 4},
{1, 1, 1, 1, 2},
{2, 2, 2, 2, 1},
{3, 3, 3, 3, 4},
{4, 4, 4, 4, 3},
{1, 2, 2, 2, 2},
{2, 2, 2, 2, 3},
{3, 3, 3, 3, 2},
{4, 3, 3, 3, 3},
{2, 1, 1, 1, 1},
{2, 3, 3, 3, 3},
{3, 2, 2, 2, 2},
{3, 4, 4, 4, 4},
{1, 1, 1, 2, 3},
{2, 2, 2, 3, 4},
{3, 3, 3, 2, 1},
{4, 4, 4, 3, 2},
{1, 2, 3, 3, 3},
{2, 3, 4, 4, 4},
{3, 2, 1, 1, 1},
{4, 3, 2, 2, 2},
{1, 1, 2, 1, 1},
{2, 2, 1, 2, 2},
{3, 3, 4, 3, 3},
{4, 4, 3, 4, 4},
{1, 2, 2, 2, 1},
{2, 2, 3, 2, 2},
{3, 3, 2, 3, 3},
{4, 3, 3, 3, 4},
{2, 1, 1, 1, 2},
{2, 3, 3, 3, 2},
{3, 2, 2, 2, 3},
{3, 4, 4, 4, 3},
}
Novomatic 40 bet lines (screen 5x4)
var BetLinesNvm9 = []Linex{
{2, 2, 2, 2, 2},
{1, 1, 1, 1, 1},
{3, 3, 3, 3, 3},
{1, 2, 3, 2, 1},
{3, 2, 1, 2, 3},
{2, 3, 3, 3, 2},
{2, 1, 1, 1, 2},
{3, 3, 2, 1, 1},
{1, 1, 2, 3, 3},
}
Novomatic 9 bet lines (old versions of games)
var BetLinesPlt15 = []Linex{
{2, 2, 2, 2, 2},
{1, 1, 1, 1, 1},
{3, 3, 3, 3, 3},
{1, 2, 3, 2, 1},
{3, 2, 1, 2, 3},
{2, 1, 1, 1, 2},
{2, 3, 3, 3, 2},
{1, 1, 2, 3, 3},
{3, 3, 2, 1, 1},
{2, 3, 2, 1, 2},
{2, 1, 2, 3, 2},
{1, 2, 2, 2, 1},
{3, 2, 2, 2, 3},
{1, 2, 1, 2, 1},
{3, 2, 3, 2, 3},
}
Playtech 15 bet lines
var BetLinesPlt30 = []Linex{
{2, 2, 2, 2, 2},
{1, 1, 1, 1, 1},
{3, 3, 3, 3, 3},
{1, 2, 3, 2, 1},
{3, 2, 1, 2, 3},
{2, 1, 1, 1, 2},
{2, 3, 3, 3, 2},
{1, 1, 2, 3, 3},
{3, 3, 2, 1, 1},
{2, 3, 2, 1, 2},
{2, 1, 2, 3, 2},
{1, 2, 2, 2, 1},
{3, 2, 2, 2, 3},
{1, 2, 1, 2, 1},
{3, 2, 3, 2, 3},
{2, 2, 1, 2, 2},
{2, 2, 3, 2, 2},
{1, 1, 3, 1, 1},
{3, 3, 1, 3, 3},
{1, 3, 3, 3, 1},
{3, 1, 1, 1, 3},
{2, 3, 1, 3, 2},
{2, 1, 3, 1, 2},
{1, 3, 1, 3, 1},
{3, 1, 3, 1, 3},
{1, 3, 2, 1, 3},
{3, 1, 2, 3, 1},
{2, 1, 3, 2, 3},
{1, 3, 2, 3, 1},
{3, 2, 1, 1, 2},
}
Playtech 30 bet lines
var MakeBitNum = util.MakeBitNum64
Functions ¶
Types ¶
type Screen ¶
type Screen interface { Dim() (Pos, Pos) // returns screen dimensions At(x, y Pos) Sym // returns symbol at position (x, y), starts from (1, 1) Pos(x Pos, line Linex) Sym // returns symbol at position (x, line(x)), starts from (1, 1) Set(x, y Pos, sym Sym) // setup symbol at given position SetCol(x Pos, reel []Sym, pos int) // setup column on screen with given reel at given position Spin(reels Reels) // fill the screen with random hits on those reels ScatNum(scat Sym) (n Pos) // returns number of scatters on the screen ScatNumOdd(scat Sym) (n Pos) // returns number of scatters on the screen on odd reels ScatNumCont(scat Sym) (n Pos) // returns number of continuous scatters on the screen ScatPos(scat Sym) Linex // returns line with scatters positions on the screen ScatPosOdd(scat Sym) Linex // returns line with scatters positions on the screen on odd reels ScatPosCont(scat Sym) Linex // returns line with continuous scatters positions on the screen FillSym() Sym // returns symbol that filled whole screen, or 0 Free() // put object to pool }
Screen contains symbols rectangle of the slot game. It can be with dimensions 3x1, 3x3, 5x3, 5x4 or others. (1 ,1) symbol is on left top corner.
type Screen3x3 ¶
type Screen3x3 [3][3]Sym
Screen for 3x3 slots.
func NewScreen3x3 ¶
func NewScreen3x3() *Screen3x3
func (*Screen3x3) ScatNumCont ¶
func (*Screen3x3) ScatNumOdd ¶
func (*Screen3x3) ScatPosCont ¶
func (*Screen3x3) ScatPosOdd ¶
type Screen5x3 ¶
type Screen5x3 [5][3]Sym
Screen for 5x3 slots.
func NewScreen5x3 ¶
func NewScreen5x3() *Screen5x3
func (*Screen5x3) ScatNumCont ¶
func (*Screen5x3) ScatNumOdd ¶
func (*Screen5x3) ScatPosCont ¶
func (*Screen5x3) ScatPosOdd ¶
type Screen5x4 ¶
type Screen5x4 [5][4]Sym
Screen for 5x4 slots.
func NewScreen5x4 ¶
func NewScreen5x4() *Screen5x4
func (*Screen5x4) ScatNumCont ¶
func (*Screen5x4) ScatNumOdd ¶
func (*Screen5x4) ScatPosCont ¶
func (*Screen5x4) ScatPosOdd ¶
type Screenx ¶
type Screenx struct {
// contains filtered or unexported fields
}
func NewScreenx ¶
func (*Screenx) MarshalJSON ¶
func (*Screenx) ScatNumCont ¶
func (*Screenx) ScatNumOdd ¶
func (*Screenx) ScatPosCont ¶
func (*Screenx) ScatPosOdd ¶
func (*Screenx) UnmarshalJSON ¶
type Slot3x3 ¶
type Slot3x3 struct { Sel Bitset `json:"sel" yaml:"sel" xml:"sel"` // selected bet lines Bet float64 `json:"bet" yaml:"bet" xml:"bet"` // bet value Gain float64 `json:"gain,omitempty" yaml:"gain,omitempty" xml:"gain,omitempty"` // gain for double up games }
Slot5x3 is base struct for all slot games with screen 5x3.
type Slot5x3 ¶
type Slot5x3 struct { Sel Bitset `json:"sel" yaml:"sel" xml:"sel"` // selected bet lines Bet float64 `json:"bet" yaml:"bet" xml:"bet"` // bet value Gain float64 `json:"gain,omitempty" yaml:"gain,omitempty" xml:"gain,omitempty"` // gain for double up games }
Slot5x3 is base struct for all slot games with screen 5x3.
type Slot5x4 ¶
type Slot5x4 struct { Sel Bitset `json:"sel" yaml:"sel" xml:"sel"` // selected bet lines Bet float64 `json:"bet" yaml:"bet" xml:"bet"` // bet value Gain float64 `json:"gain,omitempty" yaml:"gain,omitempty" xml:"gain,omitempty"` // gain for double up games }
Slot5x4 is base struct for all slot games with screen 5x4.
type SlotGame ¶
type SlotGame interface { NewScreen() Screen // returns new empty screen object for this game, constat function Scanner(Screen, *Wins) // scan given screen and append result to wins, constat function Spin(Screen, float64) // fill the screen with random hits on reels closest to given RTP, constat function Spawn(Screen, Wins) // setup bonus games to wins results, constat function Apply(Screen, Wins) // update game state to spin results FreeSpins() int // returns number of free spins remained, constat function GetGain() float64 // returns gain for double up games, constat function SetGain(float64) error // set gain to given value on double up games GetBet() float64 // returns current bet, constat function SetBet(float64) error // set bet to given value GetSel() Bitset // returns selected bet lines indexes, constat function SetSel(Bitset) error // setup selected bet lines indexes }
SlotGame is common slots interface. Any slot game should implement this interface.
type Stat ¶
type Stat struct { Reshuffles uint64 LinePay float64 ScatPay float64 FreeCount uint64 FreeHits uint64 BonusCount [8]uint64 JackCount [4]uint64 // contains filtered or unexported fields }
Stat is statistics calculation for slot reels.
type WinItem ¶
type WinItem struct { Pay float64 `json:"pay,omitempty" yaml:"pay,omitempty" xml:"pay,omitempty,attr"` // payment with selected bet Mult float64 `json:"mult,omitempty" yaml:"mult,omitempty" xml:"mult,omitempty,attr"` // multiplier for payment for free spins and other special cases Sym Sym `json:"sym,omitempty" yaml:"sym,omitempty" xml:"sym,omitempty,attr"` // win symbol Num Pos `json:"num,omitempty" yaml:"num,omitempty" xml:"num,omitempty,attr"` // number of win symbol Line int `json:"line,omitempty" yaml:"line,omitempty" xml:"line,omitempty,attr"` // line mumber (0 for scatters and not lined) XY Linex `json:"xy" yaml:"xy" xml:"xy"` // symbols positions on screen Free int `json:"free,omitempty" yaml:"free,omitempty" xml:"free,omitempty,attr"` // number of free spins remains BID int `json:"bid,omitempty" yaml:"bid,omitempty" xml:"bid,omitempty,attr"` // bonus identifier Jack int `json:"jack,omitempty" yaml:"jack,omitempty" xml:"jack,omitempty,attr"` // jackpot identifier Bon any `json:"bon,omitempty" yaml:"bon,omitempty" xml:"bon,omitempty"` // bonus game data }
WinItem describes win on each line or scatters.