mathtoolset

package
v0.13.43 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnkonow - unknow error
	ErrUnkonow = errors.New("unknow error")

	// ErrInvalidReel - invalid reel
	ErrInvalidReel = errors.New("invalid reel")

	// ErrInvalidInReelSymbolType - invalid InReelSymbolType
	ErrInvalidInReelSymbolType = errors.New("invalid InReelSymbolType")

	// ErrInvalidReelsStatsExcelFile - invalid ReelsStats excel file
	ErrInvalidReelsStatsExcelFile = errors.New("invalid ReelsStats excel file")

	// ErrInvalidReelsStatsExcelColname - invalid ReelsStats excel colname
	ErrInvalidReelsStatsExcelColname = errors.New("invalid ReelsStats excel colname")

	// ErrNoValidSymbols - no valid symbols
	ErrNoValidSymbols = errors.New("no valid symbols")

	// ErrValidParamInAutoChgWeights - invalid param in AutoChgWeights
	ErrValidParamInAutoChgWeights = errors.New("invalid param in AutoChgWeights")

	// ErrInvalidDataInAGRDataList - invalid data in agrDataList
	ErrInvalidDataInAGRDataList = errors.New("invalid data in agrDataList")

	// ErrNoResultInAutoChgWeights - no result in AutoChgWeights
	ErrNoResultInAutoChgWeights = errors.New("no result in AutoChgWeights")

	// ErrInvalidReelsWithMinOff - invalid reels with minoff
	ErrInvalidReelsWithMinOff = errors.New("invalid reels with minoff")

	// ErrInvalidCode - invalid code
	ErrInvalidCode = errors.New("invalid code")

	// ErrInvalidFunctionParams - invalid function params
	ErrInvalidFunctionParams = errors.New("invalid function params")

	// ErrInvalidTargetRTP - invalid targetRTP
	ErrInvalidTargetRTP = errors.New("invalid targetRTP")

	// ErrUnimplementedCode - unimplemented code
	ErrUnimplementedCode = errors.New("unimplemented code")

	// ErrInvalidScatterNumber - invalid scatter number
	ErrInvalidScatterNumber = errors.New("invalid scatter number")

	// ErrCannotBeConverged - cannot be converged
	ErrCannotBeConverged = errors.New("cannot be converged")

	// ErrWinWeightMerge - WinWeight.Merge error
	ErrWinWeightMerge = errors.New("WinWeight.Merge error")
	// ErrWinWeightScale - WinWeight.scale error
	ErrWinWeightScale = errors.New("WinWeight.scale error")
	// ErrDuplicateAvgWin - duplicate avgwin
	ErrDuplicateAvgWin = errors.New("duplicate avgwin")

	// ErrInvalidReelsStats2File - invalid reelsstats2 file
	ErrInvalidReelsStats2File = errors.New("invalid reelsstats2 file")
	// ErrGenStackReel - genStackReel error
	ErrGenStackReel = errors.New("genStackReel error")
)

Functions

func AutoChgWeights

func AutoChgWeights[T float32 | float64](vw *sgc7game.ValWeights, target T,
	runner FuncRunnerWithValWeights[T], precision int, cmpTarget FuncCmpTarget[T]) (*sgc7game.ValWeights, error)

func AutoChgWeightsEx

func AutoChgWeightsEx[T float32 | float64](vm *sgc7game.FloatValMapping[int, T],
	vw *sgc7game.ValWeights, target T,
	runner FuncRunnerWithValWeights[T], precision int, cmpTarget FuncCmpTarget[T]) (*sgc7game.ValWeights, error)

func AutoGenReels

func AutoGenReels(w, h int, paytables *sgc7game.PayTables, syms []SymbolType, wilds []SymbolType,
	totalBet int, lineNum int) (*sgc7game.ReelsData, error)

func CalcMulLevelRTP added in v0.10.262

func CalcMulLevelRTP(levelRTPs []float64, levelUpProbs []float64, spinNum int, levelUpAddSpinNum []int) float64

计算可升级的rtp,这里只考虑一次升级

func CalcMulLevelRTP2 added in v0.10.268

func CalcMulLevelRTP2(levelRTPs []float64, levelUpProbs []map[int]float64, spinNum int, levelUpAddSpinNum []int) float64

计算可升级的rtp,这里只考虑一次升级

func CalcProbWithWeights

func CalcProbWithWeights(vw *sgc7game.ValWeights2, probs []float64) float64

func CalcScatterProbabilitWithReels added in v0.10.261

func CalcScatterProbabilitWithReels(rd *sgc7game.ReelsData, symbol SymbolType, symbolMapping *SymbolMapping, overlaySyms *sgc7game.ValMapping2, num int, height int) float64

func CalcScatterProbability

func CalcScatterProbability(rss *ReelsStats, symbol SymbolType, num int, height int) float64

func CalcScatterWinsInReels

func CalcScatterWinsInReels(paytables *sgc7game.PayTables, rss *ReelsStats, symbol SymbolType, num int, height int) (int64, error)

CalcScatterWinsInReels -

func CalcSymbolWins

func CalcSymbolWins(rss *ReelsStats, wilds []SymbolType, symbol SymbolType, symbol2 SymbolType, lst []InReelSymbolType) (int64, error)

lst is like [S, W, S+W, No S+W, All]

func CalcSymbolWinsInReelsWithLine

func CalcSymbolWinsInReelsWithLine(paytables *sgc7game.PayTables, rss *ReelsStats, symbols []SymbolType,
	wilds []SymbolType, symbol SymbolType, num int, wildPayoutSymbol SymbolType) (int64, error)

CalcSymbolWinsInReelsWithLine - symbol 不可能是 wild

func CalcWaysWinsInReels

func CalcWaysWinsInReels(paytables *sgc7game.PayTables, rss *ReelsStats, symbol SymbolType, wilds []SymbolType, num int, height int) (int64, error)

CalcWaysWinsInReels -

func CalcWaysWinsInReelsEx

func CalcWaysWinsInReelsEx(paytables *sgc7game.PayTables, rss *ReelsStats, symbol SymbolType, wilds []SymbolType, symbolMapping *SymbolMapping, num int, height int) (int64, error)

CalcWaysWinsInReelsEx -

func CheckReels

func CheckReels(reels *sgc7game.ReelsData, minoff int) (int, int, error)

func CountSymbolInReel

func CountSymbolInReel(symbol SymbolType, reel []int, stop int, height int) int

CountSymbolInReel - count symbol number in reel,[stop, stop + height)

func CountSymbolInReelEx

func CountSymbolInReelEx(symbol SymbolType, reel []int, stop int, height int, wilds []SymbolType, symbolMapping *SymbolMapping) int

CountSymbolInReelEx - count symbol number in reel,[stop, stop + height)

func FindSymbol

func FindSymbol(symbols []SymbolType, symbol SymbolType) int

func GenMath

func GenMath(fn string) error

func GenReels

func GenReels(rss *ReelsStats, minoff int, trytimes int) (*sgc7game.ReelsData, error)

纯随机,重复符号需要不重复

func GenReelsMainSymbolsDistance

func GenReelsMainSymbolsDistance(rss *ReelsStats, mainSymbols []SymbolType, minoff int, trytimes int) (*sgc7game.ReelsData, error)

随机,主要符号需要尽量分散开

func GenStackReels added in v0.13.24

func GenStackReels(fn string, stack []int, excludeSymbol []string) ([][]string, error)

func HasSymbol

func HasSymbol(symbols []SymbolType, symbol SymbolType) bool

func IsFirstWild

func IsFirstWild(lst []InReelSymbolType, num int) bool

func SaveReels added in v0.13.24

func SaveReels(fn string, reels [][]string) error

Types

type AvgWinData added in v0.12.87

type AvgWinData struct {
	AvgWin  float64             `yaml:"win" json:"win"`
	Percent float64             `yaml:"percent" json:"percent"`
	MapWins map[int]*WinPerData `yaml:"-" json:"-"`
}

type CodeConfig

type CodeConfig struct {
	Name           string `yaml:"name"`
	Code           string `yaml:"code"`
	DisableAutoRun bool   `yaml:"disableAutoRun"`
}

type Config

type Config struct {
	Type           string          `yaml:"type"`
	Code           string          `yaml:"code"`
	Codes          []*CodeConfig   `yaml:"codes"`
	TargetRTP      float64         `yaml:"targetRTP"`
	Paytables      string          `yaml:"paytables"`
	GenReelsConfig *GenReelsConfig `yaml:"genReelsConfig"`
}

func LoadConfig

func LoadConfig(fn string) (*Config, error)

type FuncCmpTarget

type FuncCmpTarget[T float32 | float64] func(v0 T, v1 T) int

type FuncOnWaysSymbolStats

type FuncOnWaysSymbolStats func(*WaysSymbolStats)

type FuncRunnerWithValWeights

type FuncRunnerWithValWeights[T float32 | float64] func(nvw *sgc7game.ValWeights, isfastmode bool) T

type GenMathMgr

type GenMathMgr struct {
	Paytables     *sgc7game.PayTables
	MapPaytables  map[string]*sgc7game.PayTables
	MapReelsStats map[string]*ReelsStats
	MapReelsData  map[string]*sgc7game.ReelsData
	RTP           float32
	RSS           *ReelsStats
	RetStats      []*SymbolsWinsStats
	Rets          []float64
	MapRets       map[string]float64
	Config        *Config
}

func NewGamMathMgr

func NewGamMathMgr(cfg *Config) *GenMathMgr

func (*GenMathMgr) LoadPaytables

func (mgr *GenMathMgr) LoadPaytables(fn string) error

func (*GenMathMgr) LoadReelsData

func (mgr *GenMathMgr) LoadReelsData(paytablesfn string, fn string, isStrReel bool) (*sgc7game.ReelsData, error)

func (*GenMathMgr) LoadReelsState

func (mgr *GenMathMgr) LoadReelsState(fn string) error

func (*GenMathMgr) RunCode

func (mgr *GenMathMgr) RunCode(i int) error

func (*GenMathMgr) RunCodeEx

func (mgr *GenMathMgr) RunCodeEx(name string) (ref.Val, error)

func (*GenMathMgr) Save

func (mgr *GenMathMgr) Save() error

type GenReelsConfig

type GenReelsConfig struct {
	ReelsStatsFilename string   `yaml:"reelsStatsFilename"`
	ReelsFilename      string   `yaml:"reelsFilename"`
	MainSymbols        []string `yaml:"mainSymbols"`
	Offset             int      `yaml:"offset"`
}

type InReelSymbolType

type InReelSymbolType int
const (
	IRSTypeAll               InReelSymbolType = 0
	IRSTypeSymbol            InReelSymbolType = 1
	IRSTypeWild              InReelSymbolType = 2
	IRSTypeSymbolAndWild     InReelSymbolType = 3
	IRSTypeNoSymbolAndNoWild InReelSymbolType = 4
	IRSTypeNoWild            InReelSymbolType = 5
	IRSTypeNoSymbol          InReelSymbolType = 6
	IRSTypeSymbol2           InReelSymbolType = 7
	IRSTypeSymbol2AndWild    InReelSymbolType = 8
)

func NewInReelSymbolTypeArr

func NewInReelSymbolTypeArr(num int) []InReelSymbolType

type LevelRTP added in v0.12.145

type LevelRTP struct {
	LevelData map[int]*LevelRTPData
	MaxLevel  int
}

func NewLevelRTP added in v0.12.145

func NewLevelRTP() *LevelRTP

func (*LevelRTP) AddLevelData added in v0.12.145

func (levelRTP *LevelRTP) AddLevelData(level int, data *LevelRTPData)

func (*LevelRTP) CalcRTP added in v0.12.145

func (levelRTP *LevelRTP) CalcRTP(startLevel int, num int, awardNum map[int]int) float64

计算RTP,一般来说,这种用于FG的计算,num是免费次数,awardNum 是到达某个level奖励的免费次数

type LevelRTPCollectData added in v0.12.145

type LevelRTPCollectData struct {
	Collector int
	Weight    float64
}

type LevelRTPData added in v0.12.145

type LevelRTPData struct {
	Collector            map[int]*LevelRTPCollectData
	TotalCollectorWeight float64
	RTP                  float64
}

func NewLevelRTPData added in v0.12.145

func NewLevelRTPData(rtp float64) *LevelRTPData

func (*LevelRTPData) AddCollector added in v0.12.145

func (levelRTPData *LevelRTPData) AddCollector(collector int, weight float64)

type MultiLevelRTPData added in v0.12.163

type MultiLevelRTPData struct {
	Nodes []*MultiLevelRTPNode
}

func NewMultiLevelRTPData added in v0.12.163

func NewMultiLevelRTPData() *MultiLevelRTPData

func (*MultiLevelRTPData) CalcMulLevelRTP2 added in v0.12.163

func (rtpdata *MultiLevelRTPData) CalcMulLevelRTP2(levelRTPs []float64, levelUpProbs []map[int]float64, spinNum int, levelUpAddSpinNum []int) float64

func (*MultiLevelRTPData) Format added in v0.12.187

func (rtpdata *MultiLevelRTPData) Format() *MultiLevelRTPData

func (*MultiLevelRTPData) SaveResults added in v0.12.163

func (rtpdata *MultiLevelRTPData) SaveResults(fn string) error

type MultiLevelRTPNode added in v0.12.163

type MultiLevelRTPNode struct {
	SpinNum     int
	EndingLevel int
	RTP         float64
	Percent     float64
	TotalRTP    float64
}

type ReelStats

type ReelStats struct {
	MapSymbols     map[SymbolType]*SymbolStats
	TotalSymbolNum int
}

func BuildReelStats

func BuildReelStats(reel []int, mapSymbols *SymbolsMapping) (*ReelStats, error)

func NewReelStats

func NewReelStats() *ReelStats

func (*ReelStats) AddSymbol

func (rs *ReelStats) AddSymbol(symbol SymbolType, num int)

func (*ReelStats) BuildSymbols

func (rs *ReelStats) BuildSymbols(excludeSymbols []SymbolType) []SymbolType

func (*ReelStats) BuildSymbols2

func (rs *ReelStats) BuildSymbols2(excludeSymbols1 []SymbolType, excludeSymbols2 []SymbolType) []SymbolType

func (*ReelStats) BuildSymbolsEx

func (rs *ReelStats) BuildSymbolsEx(symbols []SymbolType) []SymbolType

func (*ReelStats) BuildSymbolsWithWeights

func (rs *ReelStats) BuildSymbolsWithWeights(excludeSymbols []SymbolType) (*sgc7game.ValWeights, error)

func (*ReelStats) BuildSymbolsWithWeights2

func (rs *ReelStats) BuildSymbolsWithWeights2(excludeSymbols1 []SymbolType, excludeSymbols2 []SymbolType) (*sgc7game.ValWeights, error)

func (*ReelStats) BuildSymbolsWithWeightsEx

func (rs *ReelStats) BuildSymbolsWithWeightsEx(symbols []SymbolType) (*sgc7game.ValWeights, error)

func (*ReelStats) Clone

func (rs *ReelStats) Clone() *ReelStats

func (*ReelStats) CountSymbolsNum

func (rs *ReelStats) CountSymbolsNum(symbols []SymbolType) int

func (*ReelStats) GetCanAddSymbols

func (rs *ReelStats) GetCanAddSymbols(symbols []SymbolType) []SymbolType

func (*ReelStats) GetSymbolStats

func (rs *ReelStats) GetSymbolStats(symbol SymbolType) *SymbolStats

func (*ReelStats) GetSymbolWithIndex

func (rs *ReelStats) GetSymbolWithIndex(index int) SymbolType

func (*ReelStats) RemoveSymbol

func (rs *ReelStats) RemoveSymbol(symbol SymbolType, num int) int

type ReelStats2 added in v0.13.24

type ReelStats2 struct {
	MapSymbols     map[string]int
	TotalSymbolNum int
}

type ReelsStats

type ReelsStats struct {
	Reels   []*ReelStats
	Symbols []SymbolType
}

func BuildBasicReelsStats

func BuildBasicReelsStats(reelnum int, paytables *sgc7game.PayTables, excludeSyms []SymbolType) (*ReelsStats, error)

func BuildBasicReelsStatsEx

func BuildBasicReelsStatsEx(reelnum int, syms []SymbolType) (*ReelsStats, error)

func BuildReelsStats

func BuildReelsStats(reels *sgc7game.ReelsData, mapSymbols *SymbolsMapping) (*ReelsStats, error)

func LoadReelsStats

func LoadReelsStats(fn string) (*ReelsStats, error)

func (*ReelsStats) ClearEmptySymbols

func (rss *ReelsStats) ClearEmptySymbols()

func (*ReelsStats) Clone

func (rss *ReelsStats) Clone() *ReelsStats

func (*ReelsStats) CloneWithMapping

func (rss *ReelsStats) CloneWithMapping(mapSymbols *SymbolsMapping) *ReelsStats

func (*ReelsStats) GetNum

func (rss *ReelsStats) GetNum(reelindex int, symbol SymbolType, symbol2 SymbolType,
	wilds []SymbolType, irstype InReelSymbolType) int

func (*ReelsStats) GetReelLength

func (rss *ReelsStats) GetReelLength(reelindex int) int

func (*ReelsStats) GetReelLengthNoSymbol

func (rss *ReelsStats) GetReelLengthNoSymbol(reelindex int, symbol SymbolType, wilds []SymbolType) int

func (*ReelsStats) GetScatterNum

func (rss *ReelsStats) GetScatterNum(reelindex int, symbol SymbolType, irstype InReelSymbolType, height int) int

func (*ReelsStats) GetSymbolNum

func (rss *ReelsStats) GetSymbolNum(reelindex int, symbol SymbolType, wilds []SymbolType) int

func (*ReelsStats) GetSymbolNumNoWild

func (rss *ReelsStats) GetSymbolNumNoWild(reelindex int, symbol SymbolType, wilds []SymbolType) int

func (*ReelsStats) GetWaysNum

func (rss *ReelsStats) GetWaysNum(reelindex int, symbol SymbolType, wilds []SymbolType, irstype InReelSymbolType, height int) int

func (*ReelsStats) GetWaysNumEx

func (rss *ReelsStats) GetWaysNumEx(reelindex int, symbol SymbolType, wilds []SymbolType, symbolMapping *SymbolMapping, irstype InReelSymbolType, height int) int

func (*ReelsStats) HasSymbols

func (rss *ReelsStats) HasSymbols(symbol SymbolType) bool

func (*ReelsStats) SaveExcel

func (rss *ReelsStats) SaveExcel(fn string) error

type ReelsStats2 added in v0.13.24

type ReelsStats2 struct {
	Reels   []*ReelStats2
	Symbols []string
}

func LoadReelsStats2 added in v0.13.24

func LoadReelsStats2(fn string) (*ReelsStats2, error)

func NewReelsStats2 added in v0.13.24

func NewReelsStats2(reelnum int) *ReelsStats2

type ScriptCore

type ScriptCore struct {
	Cel *cel.Env
	Ast *cel.Ast
	Prg *cel.Program
}

func NewScriptCore

func NewScriptCore(mgrGenMath *GenMathMgr) (*ScriptCore, error)

func (*ScriptCore) Compile

func (sc *ScriptCore) Compile(code string) error

func (*ScriptCore) Eval

func (sc *ScriptCore) Eval(mgr *GenMathMgr) (ref.Val, error)

type SymbolMapping

type SymbolMapping struct {
	MapSymbols map[SymbolType]SymbolType
}

func NewSymbolMapping

func NewSymbolMapping() *SymbolMapping

func (*SymbolMapping) Has

func (sm *SymbolMapping) Has(dst SymbolType, cur SymbolType) bool

func (*SymbolMapping) HasTarget

func (sm *SymbolMapping) HasTarget(cur SymbolType) bool

func (*SymbolMapping) IsSameKeys

func (sm *SymbolMapping) IsSameKeys(vm *sgc7game.ValMapping2) bool

type SymbolStats

type SymbolStats struct {
	Symbol SymbolType
	Num    int
}

type SymbolType

type SymbolType int

func CloneSymbols

func CloneSymbols(symbols []SymbolType) []SymbolType

func GetSymbols

func GetSymbols(arr []string, paytables *sgc7game.PayTables) []SymbolType

type SymbolWinsStats

type SymbolWinsStats struct {
	Symbol  SymbolType
	WinsNum []int64
	Wins    []int64
	Total   int64
}

func (*SymbolWinsStats) Clone

func (sws *SymbolWinsStats) Clone() *SymbolWinsStats

func (*SymbolWinsStats) IsFine

func (sws *SymbolWinsStats) IsFine() bool

func (*SymbolWinsStats) Merge

func (sws *SymbolWinsStats) Merge(sws1 *SymbolWinsStats)

func (*SymbolWinsStats) MergeWithMulti

func (sws *SymbolWinsStats) MergeWithMulti(sws1 *SymbolWinsStats, multi int)

type SymbolsMapping

type SymbolsMapping struct {
	MapSymbols map[SymbolType]SymbolType
}

func NewSymbolsMapping

func NewSymbolsMapping() *SymbolsMapping

func (*SymbolsMapping) Add

func (mapSymbols *SymbolsMapping) Add(src SymbolType, dest SymbolType)

func (*SymbolsMapping) Has

func (mapSymbols *SymbolsMapping) Has(s SymbolType) bool

type SymbolsWinsFileMode

type SymbolsWinsFileMode int
const (
	SWFModeRTP        SymbolsWinsFileMode = 1
	SWFModeWins       SymbolsWinsFileMode = 2
	SWFModeWinsNum    SymbolsWinsFileMode = 3
	SWFModeWinsNumPer SymbolsWinsFileMode = 4
)

type SymbolsWinsStats

type SymbolsWinsStats struct {
	MapSymbols map[SymbolType]*SymbolWinsStats
	Symbols    []SymbolType
	Num        int
	TotalBet   int64
	TotalWins  int64
}

func AnalyzeReelsScatter

func AnalyzeReelsScatter(paytables *sgc7game.PayTables, reels *sgc7game.ReelsData,
	symbols []SymbolType, mapSymbols *SymbolsMapping, height int) (*SymbolsWinsStats, error)

func AnalyzeReelsScatterEx

func AnalyzeReelsScatterEx(paytables *sgc7game.PayTables, rss *ReelsStats,
	symbols []SymbolType, height int) (*SymbolsWinsStats, error)

func AnalyzeReelsWaysEx

func AnalyzeReelsWaysEx(paytables *sgc7game.PayTables, rss *ReelsStats,
	symbols []SymbolType, wilds []SymbolType, symbolMapping *SymbolMapping, height int, bet int, mul int) (*SymbolsWinsStats, error)

AnalyzeReelsWaysEx - totalbet = reels length x mul, wins = symbol wins x mul

func AnalyzeReelsWaysEx2

func AnalyzeReelsWaysEx2(paytables *sgc7game.PayTables, rd *sgc7game.ReelsData,
	symbols []SymbolType, wilds []SymbolType, symbolMapping *SymbolMapping, symMul *sgc7game.ValMapping2, overlaySyms *sgc7game.ValMapping2,
	height int, bet int, mul int) (*SymbolsWinsStats, error)

func AnalyzeReelsWaysEx3 added in v0.10.259

func AnalyzeReelsWaysEx3(paytables *sgc7game.PayTables, rd *sgc7game.ReelsData,
	symbols []SymbolType, wilds []SymbolType, symbolMapping *SymbolMapping, symMul *sgc7game.ValMapping2, overlaySyms *sgc7game.ValMapping2,
	height int, bet int, mul int) (*SymbolsWinsStats, error)

func AnalyzeReelsWaysSymbolMulti

func AnalyzeReelsWaysSymbolMulti(paytables *sgc7game.PayTables, rss *ReelsStats,
	symbols []SymbolType, wilds []SymbolType, symbolMapping *SymbolMapping, symMul *sgc7game.ValMapping2, height int, bet int, mul int) (*SymbolsWinsStats, error)

AnalyzeReelsWaysSymbolMulti - totalbet = reels length x mul, wins = symbol wins x mul

func AnalyzeReelsWithLine

func AnalyzeReelsWithLine(paytables *sgc7game.PayTables, reels *sgc7game.ReelsData,
	symbols []SymbolType, wilds []SymbolType, mapSymbols *SymbolsMapping, betMul int, lineNum int) (*SymbolsWinsStats, error)

func AnalyzeReelsWithLineEx

func AnalyzeReelsWithLineEx(paytables *sgc7game.PayTables, rss *ReelsStats,
	symbols []SymbolType, wilds []SymbolType, betMul int, lineNum int) (*SymbolsWinsStats, error)

func NewSymbolsWinsStats

func NewSymbolsWinsStats(num int) *SymbolsWinsStats

func (*SymbolsWinsStats) Clone

func (ssws *SymbolsWinsStats) Clone() *SymbolsWinsStats

func (*SymbolsWinsStats) CountRTP

func (ssws *SymbolsWinsStats) CountRTP() float64

func (*SymbolsWinsStats) GetSymbolWinsStats

func (ssws *SymbolsWinsStats) GetSymbolWinsStats(symbol SymbolType) *SymbolWinsStats

func (*SymbolsWinsStats) IsFine

func (ssws *SymbolsWinsStats) IsFine() bool

func (*SymbolsWinsStats) Merge

func (ssws *SymbolsWinsStats) Merge(ssws1 *SymbolsWinsStats)

func (*SymbolsWinsStats) MergeWithMulti

func (ssws *SymbolsWinsStats) MergeWithMulti(ssws1 *SymbolsWinsStats, multi int)

func (*SymbolsWinsStats) SaveExcel

func (ssws *SymbolsWinsStats) SaveExcel(fn string, fms []SymbolsWinsFileMode) error

func (*SymbolsWinsStats) SaveExcelSheet

func (ssws *SymbolsWinsStats) SaveExcelSheet(f *excelize.File, fm SymbolsWinsFileMode) error

type WaysReelStats

type WaysReelStats struct {
	MapSymbols     map[int]*WaysSymbolStats
	TotalSymbolNum int
}

func (*WaysReelStats) EachSymbol

func (wrs *WaysReelStats) EachSymbol(symbol SymbolType, onEach FuncOnWaysSymbolStats)

func (*WaysReelStats) GetNumWithSymbolNumInWindow

func (wrs *WaysReelStats) GetNumWithSymbolNumInWindow(symbol SymbolType, numInWindow int) int

func (*WaysReelStats) GetSymbolKeys

func (wrs *WaysReelStats) GetSymbolKeys(symbol SymbolType) []int

func (*WaysReelStats) GetSymbolStats

func (wrs *WaysReelStats) GetSymbolStats(symbol SymbolType, numInWindow int) *WaysSymbolStats

type WaysReelsStats

type WaysReelsStats struct {
	Reels   []*WaysReelStats
	Symbols []SymbolType
	Keys    []int
	Height  int
}

func BuildWaysReelsStats

func BuildWaysReelsStats(rd *sgc7game.ReelsData, height int) *WaysReelsStats

func BuildWaysReelsStatsEx

func BuildWaysReelsStatsEx(rd *sgc7game.ReelsData, height int, symbols []SymbolType, wilds []SymbolType, symbolMapping *SymbolMapping) *WaysReelsStats

BuildWaysReelsStatsEx - 只计算symbols里的symbol,且把wild直接计算进去

func NewWaysReelsStats

func NewWaysReelsStats(height int) *WaysReelsStats

func (*WaysReelsStats) GetNonWaysNum

func (wrss *WaysReelsStats) GetNonWaysNum(reelindex int, symbol SymbolType) int

func (*WaysReelsStats) SaveExcel

func (wrss *WaysReelsStats) SaveExcel(fn string) error

type WaysSymbolStats

type WaysSymbolStats struct {
	Symbol      SymbolType
	NumInWindow int
	Num         int
}

type WinAreaData added in v0.12.92

type WinAreaData struct {
	Wins         []*WinData `yaml:"wins" json:"wins"`
	TotalWeights int64      `yaml:"maxWeight" json:"maxWeight"`
	AvgWin       float64    `yaml:"avgWin" json:"avgWin"`
	Percent      float64    `yaml:"percent" json:"percent"`
}

func (*WinAreaData) Fit added in v0.12.92

func (wad *WinAreaData) Fit(avgWin float64, bet int, options *WinWeightFitOptions) bool

func (*WinAreaData) Fit2 added in v0.12.108

func (wad *WinAreaData) Fit2(avgWin float64, bet int, options *WinWeightFitOptions) bool

func (*WinAreaData) FitEnding added in v0.12.120

func (wad *WinAreaData) FitEnding(avgWin float64, bet int, options *WinWeightFitOptions) bool

func (*WinAreaData) Format added in v0.12.137

func (wad *WinAreaData) Format(options *WinWeightFitOptions)

type WinData added in v0.12.92

type WinData struct {
	Win    int `yaml:"win" json:"win"`
	Weight int `yaml:"weight" json:"weight"`
	Data   any `yaml:"data" json:"data"`
}

func (*WinData) Clone added in v0.12.120

func (wd *WinData) Clone() *WinData

type WinPerData added in v0.12.87

type WinPerData struct {
	Win     int
	Percent float64
}

type WinTimesData added in v0.12.87

type WinTimesData struct {
	Win   int
	Times int64
}

type WinWeight added in v0.12.92

type WinWeight struct {
	MapData map[int]*WinAreaData
}

func NewWinWeight added in v0.12.92

func NewWinWeight() *WinWeight

func (*WinWeight) Add added in v0.12.92

func (ww *WinWeight) Add(win int, bet int, data any)

func (*WinWeight) Fit added in v0.12.92

func (ww *WinWeight) Fit(wd *WinningDistribution, bet int, options *WinWeightFitOptions) (*WinWeight, error)

func (*WinWeight) Fit2 added in v0.12.108

func (ww *WinWeight) Fit2(wd *WinningDistribution, bet int, options *WinWeightFitOptions) (*WinWeight, error)

type WinWeightFitOptions added in v0.12.92

type WinWeightFitOptions struct {
	FuncGetDataNum func(any) int
	FuncSetWeight  func(any, int)
	WinScale       int // 在fit时,这个是比较精度,一般给100即可,就是精确到0.01
	RTPScale       int // 在fitending时,用这个替代winscale,一般来说,这个最好要精确到0.0001
	MaxFitTimes    int
	MinNodes       int // merge时,某一边节点数低于这个就需要merge
	MinSeeds       int // merge时,某一边seed数低于这个就需要merge
	TotalWeight    int // 总权重
}

type WinningDistribution added in v0.12.87

type WinningDistribution struct {
	TimesWins   map[int]*WinTimesData `yaml:"-" json:"-"`
	PercentWins map[int]*WinPerData   `yaml:"-" json:"-"`
	AvgWins     map[int]*AvgWinData   `yaml:"avgwins" json:"avgwins"`
	TotalTimes  int64                 `yaml:"-" json:"-"`
}

func LoadWinningDistribution added in v0.12.89

func LoadWinningDistribution(fn string) (*WinningDistribution, error)

func LoadWinningDistributionFromExcel added in v0.12.131

func LoadWinningDistributionFromExcel(fn string) (*WinningDistribution, error)

func NewWinningDistribution added in v0.12.87

func NewWinningDistribution() *WinningDistribution

func (*WinningDistribution) AddAvgWin added in v0.12.131

func (wd *WinningDistribution) AddAvgWin(winf float64, percent float64) error

func (*WinningDistribution) AddPercentWin added in v0.12.87

func (wd *WinningDistribution) AddPercentWin(win int, percent float64)

func (*WinningDistribution) AddTimesWin added in v0.12.87

func (wd *WinningDistribution) AddTimesWin(win int, times int64)

func (*WinningDistribution) Format added in v0.12.110

func (wd *WinningDistribution) Format(maxwin int, isneedsmooth bool)

func (*WinningDistribution) GenAvgWinData added in v0.12.87

func (wd *WinningDistribution) GenAvgWinData(bet int)

func (*WinningDistribution) Save added in v0.12.89

func (wd *WinningDistribution) Save(fn string)

func (*WinningDistribution) SaveExcel added in v0.12.87

func (wd *WinningDistribution) SaveExcel(fn string, scale float64)

Jump to

Keyboard shortcuts

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