game

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	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")
	ErrNoReels    = errors.New("no reels for given descriptor")
)
View Source
var BetLinesBetSoft25 = Lineset5x{
	{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

View Source
var BetLinesBetSoft30 = Lineset5x{
	{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

View Source
var BetLinesHot3 = Lineset3x{
	{2, 2, 2},
	{1, 1, 1},
	{3, 3, 3},
	{1, 2, 3},
	{3, 2, 1},
}

Ultra Hot 3x3 bet lines

View Source
var BetLinesHot5 = Lineset5x{
	{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},
}

Hot 5x3 bet lines

View Source
var BetLinesMgj = Lineset5x{
	{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

View Source
var BetLinesNetEnt10 = Lineset5x{
	{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

View Source
var BetLinesNetEnt20 = Lineset5x{
	{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

View Source
var BetLinesNvm10 = Lineset5x{
	{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)

View Source
var BetLinesNvm15 = Lineset5x{
	{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},
}

Novomatic 15 bet lines

View Source
var BetLinesNvm20 = Lineset5x{
	{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)

View Source
var BetLinesNvm40 = Lineset5x{
	{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)

View Source
var BetLinesNvm9 = Lineset5x{
	{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)

View Source
var BetLinesPlt9 = Lineset5x{
	{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},
}

Playtech 9 bet lines

Functions

func BruteForce3x

func BruteForce3x(ctx context.Context, s Stater, g SlotGame, reels Reels)

func BruteForce5x

func BruteForce5x(ctx context.Context, s Stater, g SlotGame, reels Reels)

func MonteCarlo

func MonteCarlo(ctx context.Context, s Stater, g SlotGame, n int)

Types

type Line

type Line interface {
	At(x int) int   // returns symbol at position x, starts from 1
	Set(x, val int) // set value at position x
	Len() int       // returns length of line
	Free()          // put object to pool

	CopyL(num int) Line
	CopyR(num int) Line
}

type Line3x

type Line3x [5]int

func NewLine3x

func NewLine3x() *Line3x

func (*Line3x) At

func (l *Line3x) At(x int) int

func (*Line3x) CopyL

func (l *Line3x) CopyL(num int) Line

func (*Line3x) CopyR

func (l *Line3x) CopyR(num int) Line

func (*Line3x) Free

func (l *Line3x) Free()

func (*Line3x) Len

func (l *Line3x) Len() int

func (*Line3x) Set

func (l *Line3x) Set(x, val int)

type Line5x

type Line5x [5]int

func NewLine5x

func NewLine5x() *Line5x

func (*Line5x) At

func (l *Line5x) At(x int) int

func (*Line5x) CopyL

func (l *Line5x) CopyL(num int) Line

func (*Line5x) CopyR

func (l *Line5x) CopyR(num int) Line

func (*Line5x) Free

func (l *Line5x) Free()

func (*Line5x) Len

func (l *Line5x) Len() int

func (*Line5x) Set

func (l *Line5x) Set(x, val int)

type Lineset

type Lineset interface {
	Cols() int     // returns number of columns
	Line(int) Line // returns line with given number, starts from 1
	Num() int      // returns number lines in set
}

type Lineset3x

type Lineset3x []Line5x

func (Lineset3x) Cols

func (ls Lineset3x) Cols() int

func (Lineset3x) Line

func (ls Lineset3x) Line(n int) Line

func (Lineset3x) Num

func (ls Lineset3x) Num() int

type Lineset5x

type Lineset5x []Line5x

func (Lineset5x) Cols

func (ls Lineset5x) Cols() int

func (Lineset5x) Line

func (ls Lineset5x) Line(n int) Line

func (Lineset5x) Num

func (ls Lineset5x) Num() int

type Reels

type Reels interface {
	Cols() int          // returns number of columns
	Reel(col int) []Sym // returns reel at given column, index from
	Reshuffles() int    // returns total number of reshuffles
}

type Reels3x

type Reels3x [3][]Sym

Reels for 3-reels slots.

func (*Reels3x) Cols

func (r *Reels3x) Cols() int

func (*Reels3x) Reel

func (r *Reels3x) Reel(col int) []Sym

func (*Reels3x) Reshuffles

func (r *Reels3x) Reshuffles() int

type Reels5x

type Reels5x [5][]Sym

Reels for 5-reels slots.

func (*Reels5x) Cols

func (r *Reels5x) Cols() int

func (*Reels5x) Reel

func (r *Reels5x) Reel(col int) []Sym

func (*Reels5x) Reshuffles

func (r *Reels5x) Reshuffles() int

type SBL

type SBL uint

SBL is selected bet lines bitset.

func MakeSblNum

func MakeSblNum(num int) SBL

MakeSblNum creates lines set with first num lines.

func MakeSblSet

func MakeSblSet(lines ...int) SBL

MakeSblSet creates lines set from slice of line indexes.

func (SBL) Is

func (sbl SBL) Is(n int) bool

Is checks that line with given number is set.

func (SBL) Next

func (sbl SBL) Next(n int) int

Next helps iterate lines numbers as followed:

for n := sbl.Next(0); n != 0; n = sbl.Next(n) {}

func (SBL) Num

func (sbl SBL) Num() int

Num returns number of selected lines in set.

func (*SBL) Set

func (sbl *SBL) Set(n int)

Set line with given number.

func (*SBL) SetNum

func (sbl *SBL) SetNum(n int)

Sets first n lines.

func (*SBL) Toggle

func (sbl *SBL) Toggle(n int) bool

Toggle line with given number and return whether it set.

type Screen

type Screen interface {
	Dim() (int, int)                   // returns screen dimensions
	At(x int, y int) Sym               // returns symbol at position (x, y), starts from (1, 1)
	Pos(x int, line Line) Sym          // returns symbol at position (x, line(x)), starts from (1, 1)
	Set(x int, y int, sym Sym)         // setup symbol at given position
	SetCol(x int, 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 int)          // returns number of scatters on the screen
	ScatNumOdd(scat Sym) (n int)       // returns number of scatters on the screen on odd reels
	ScatNumCont(scat Sym) (n int)      // returns number of continuous scatters on the screen
	ScatPos(scat Sym) Line             // returns line with scatters positions on the screen
	ScatPosOdd(scat Sym) Line          // returns line with scatters positions on the screen on odd reels
	ScatPosCont(scat Sym) Line         // 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) At

func (s *Screen3x3) At(x int, y int) Sym

func (*Screen3x3) Dim

func (s *Screen3x3) Dim() (int, int)

func (*Screen3x3) FillSym

func (s *Screen3x3) FillSym() Sym

func (*Screen3x3) Free

func (s *Screen3x3) Free()

func (*Screen3x3) Pos

func (s *Screen3x3) Pos(x int, line Line) Sym

func (*Screen3x3) ScatNum

func (s *Screen3x3) ScatNum(scat Sym) (n int)

func (*Screen3x3) ScatNumCont

func (s *Screen3x3) ScatNumCont(scat Sym) (n int)

func (*Screen3x3) ScatNumOdd

func (s *Screen3x3) ScatNumOdd(scat Sym) (n int)

func (*Screen3x3) ScatPos

func (s *Screen3x3) ScatPos(scat Sym) Line

func (*Screen3x3) ScatPosCont

func (s *Screen3x3) ScatPosCont(scat Sym) Line

func (*Screen3x3) ScatPosOdd

func (s *Screen3x3) ScatPosOdd(scat Sym) Line

func (*Screen3x3) Set

func (s *Screen3x3) Set(x int, y int, sym Sym)

func (*Screen3x3) SetCol

func (s *Screen3x3) SetCol(x int, reel []Sym, pos int)

func (*Screen3x3) Spin

func (s *Screen3x3) Spin(reels Reels)

type Screen5x3

type Screen5x3 [5][3]Sym

Screen for 5x3 slots.

func NewScreen5x3

func NewScreen5x3() *Screen5x3

func (*Screen5x3) At

func (s *Screen5x3) At(x int, y int) Sym

func (*Screen5x3) Dim

func (s *Screen5x3) Dim() (int, int)

func (*Screen5x3) FillSym

func (s *Screen5x3) FillSym() Sym

func (*Screen5x3) Free

func (s *Screen5x3) Free()

func (*Screen5x3) Pos

func (s *Screen5x3) Pos(x int, line Line) Sym

func (*Screen5x3) ScatNum

func (s *Screen5x3) ScatNum(scat Sym) (n int)

func (*Screen5x3) ScatNumCont

func (s *Screen5x3) ScatNumCont(scat Sym) (n int)

func (*Screen5x3) ScatNumOdd

func (s *Screen5x3) ScatNumOdd(scat Sym) (n int)

func (*Screen5x3) ScatPos

func (s *Screen5x3) ScatPos(scat Sym) Line

func (*Screen5x3) ScatPosCont

func (s *Screen5x3) ScatPosCont(scat Sym) Line

func (*Screen5x3) ScatPosOdd

func (s *Screen5x3) ScatPosOdd(scat Sym) Line

func (*Screen5x3) Set

func (s *Screen5x3) Set(x int, y int, sym Sym)

func (*Screen5x3) SetCol

func (s *Screen5x3) SetCol(x int, reel []Sym, pos int)

func (*Screen5x3) Spin

func (s *Screen5x3) Spin(reels Reels)

type Screen5x4

type Screen5x4 [5][4]Sym

Screen for 5x4 slots.

func NewScreen5x4

func NewScreen5x4() *Screen5x4

func (*Screen5x4) At

func (s *Screen5x4) At(x int, y int) Sym

func (*Screen5x4) Dim

func (s *Screen5x4) Dim() (int, int)

func (*Screen5x4) FillSym

func (s *Screen5x4) FillSym() Sym

func (*Screen5x4) Free

func (s *Screen5x4) Free()

func (*Screen5x4) Pos

func (s *Screen5x4) Pos(x int, line Line) Sym

func (*Screen5x4) ScatNum

func (s *Screen5x4) ScatNum(scat Sym) (n int)

func (*Screen5x4) ScatNumCont

func (s *Screen5x4) ScatNumCont(scat Sym) (n int)

func (*Screen5x4) ScatNumOdd

func (s *Screen5x4) ScatNumOdd(scat Sym) (n int)

func (*Screen5x4) ScatPos

func (s *Screen5x4) ScatPos(scat Sym) Line

func (*Screen5x4) ScatPosCont

func (s *Screen5x4) ScatPosCont(scat Sym) Line

func (*Screen5x4) ScatPosOdd

func (s *Screen5x4) ScatPosOdd(scat Sym) Line

func (*Screen5x4) Set

func (s *Screen5x4) Set(x int, y int, sym Sym)

func (*Screen5x4) SetCol

func (s *Screen5x4) SetCol(x int, reel []Sym, pos int)

func (*Screen5x4) Spin

func (s *Screen5x4) Spin(reels Reels)

type Slot3x3

type Slot3x3 struct {
	RD  string  `json:"rd" yaml:"rd" xml:"rd"`    // reels descriptor
	SBL SBL     `json:"sbl" yaml:"sbl" xml:"sbl"` // 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.

func (*Slot3x3) Apply

func (g *Slot3x3) Apply(screen Screen, sw *WinScan)

func (*Slot3x3) FreeSpins

func (g *Slot3x3) FreeSpins() int

func (*Slot3x3) GetBet

func (g *Slot3x3) GetBet() float64

func (*Slot3x3) GetGain

func (g *Slot3x3) GetGain() float64

func (*Slot3x3) GetLines

func (g *Slot3x3) GetLines() SBL

func (*Slot3x3) GetReels

func (g *Slot3x3) GetReels() string

func (*Slot3x3) NewScreen

func (g *Slot3x3) NewScreen() Screen

func (*Slot3x3) SetBet

func (g *Slot3x3) SetBet(bet float64) error

func (*Slot3x3) SetGain

func (g *Slot3x3) SetGain(gain float64) error

func (*Slot3x3) Spawn

func (g *Slot3x3) Spawn(screen Screen, sw *WinScan)

type Slot5x3

type Slot5x3 struct {
	RD  string  `json:"rd" yaml:"rd" xml:"rd"`    // reels descriptor
	SBL SBL     `json:"sbl" yaml:"sbl" xml:"sbl"` // 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.

func (*Slot5x3) Apply

func (g *Slot5x3) Apply(screen Screen, sw *WinScan)

func (*Slot5x3) FreeSpins

func (g *Slot5x3) FreeSpins() int

func (*Slot5x3) GetBet

func (g *Slot5x3) GetBet() float64

func (*Slot5x3) GetGain

func (g *Slot5x3) GetGain() float64

func (*Slot5x3) GetLines

func (g *Slot5x3) GetLines() SBL

func (*Slot5x3) GetReels

func (g *Slot5x3) GetReels() string

func (*Slot5x3) NewScreen

func (g *Slot5x3) NewScreen() Screen

func (*Slot5x3) SetBet

func (g *Slot5x3) SetBet(bet float64) error

func (*Slot5x3) SetGain

func (g *Slot5x3) SetGain(gain float64) error

func (*Slot5x3) Spawn

func (g *Slot5x3) Spawn(screen Screen, sw *WinScan)

type Slot5x4

type Slot5x4 struct {
	RD  string  `json:"rd" yaml:"rd" xml:"rd"`    // reels descriptor
	SBL SBL     `json:"sbl" yaml:"sbl" xml:"sbl"` // 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.

func (*Slot5x4) Apply

func (g *Slot5x4) Apply(screen Screen, sw *WinScan)

func (*Slot5x4) FreeSpins

func (g *Slot5x4) FreeSpins() int

func (*Slot5x4) GetBet

func (g *Slot5x4) GetBet() float64

func (*Slot5x4) GetGain

func (g *Slot5x4) GetGain() float64

func (*Slot5x4) GetLines

func (g *Slot5x4) GetLines() SBL

func (*Slot5x4) GetReels

func (g *Slot5x4) GetReels() string

func (*Slot5x4) NewScreen

func (g *Slot5x4) NewScreen() Screen

func (*Slot5x4) SetBet

func (g *Slot5x4) SetBet(bet float64) error

func (*Slot5x4) SetGain

func (g *Slot5x4) SetGain(gain float64) error

func (*Slot5x4) Spawn

func (g *Slot5x4) Spawn(screen Screen, sw *WinScan)

type SlotGame

type SlotGame interface {
	NewScreen() Screen                  // returns new empty screen object for this game, constat function
	Scanner(screen Screen, sw *WinScan) // scan given screen and append result to sw, constat function
	Spin(screen Screen)                 // fill the screen with random hits on those reels, constat function
	Spawn(screen Screen, sw *WinScan)   // setup bonus games to win results, constat function
	Apply(screen Screen, sw *WinScan)   // 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(gain 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
	GetLines() SBL                      // returns selected lines indexes, constat function
	SetLines(SBL) error                 // setup selected lines indexes
	GetReels() string                   // returns reels descriptor
	SetReels(rd string) error           // setup reels descriptor
}

type Stat

type Stat struct {
	Reshuffles uint64
	LinePay    float64
	ScatPay    float64
	FreeCount  uint64
	BonusCount [8]uint64
	JackCount  [4]uint64
	// contains filtered or unexported fields
}

Stat is statistics calculation for slot reels.

func (*Stat) Count

func (s *Stat) Count() uint64

func (*Stat) Progress

func (s *Stat) Progress(ctx context.Context, steps *time.Ticker, sel, total float64)

func (*Stat) Update

func (s *Stat) Update(sw *WinScan)

type Stater

type Stater interface {
	Count() uint64
	Update(sw *WinScan)
}

type Sym

type Sym byte // symbol type

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  int     `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   Line    `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.

type WinScan

type WinScan struct {
	Wins []WinItem `json:"wins,omitempty" yaml:"wins,omitempty" xml:"wins,omitempty"`
}

WinScan is full list of wins by all lines and scatters for some spin.

func (*WinScan) Gain

func (ws *WinScan) Gain() float64

Total gain for spin.

func (*WinScan) Reset

func (ws *WinScan) Reset()

Reset puts lines to pool and set array empty with saved capacity.

Jump to

Keyboard shortcuts

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