server icon indicating copy to clipboard operation
server copied to clipboard

Combinator generator to reel all possible spins

Open heatblazer opened this issue 2 months ago • 2 comments

Hello I've implemented a generator for reels to simulate all possible positions for the reels. Since I can't see the possibility to make a branch I am posting it here (you can replace the reel screen logic's random with it to permute all possible line symbols:

type CombGeneratorV2 struct {
	c             chan int
	i, j, h, k, l int
	data          []int
}

func MakeCombGeneratorV2(i, j, h, k, l int) *CombGeneratorV2 {
	cg := CombGeneratorV2{}
	cg.data = make([]int, 5)
	cg.c = make(chan int)
	cg.i = i
	cg.j = j
	cg.h = h
	cg.l = l
	cg.k = k
	return &cg
}

func (cg *CombGeneratorV2) Init(offset int) {
	go func() {
		for i := offset; i <= cg.i; i++ {
			for j := offset; j <= cg.j; j++ {
				for h := offset; h <= cg.h; h++ {
					for k := offset; k <= cg.k; k++ {
						for l := offset; l <= cg.l; l++ {
							cg.c <- i
							cg.c <- j
							cg.c <- h
							cg.c <- k
							cg.c <- l
						}
					}
				}
			}
		}
	}()
}

func (cg *CombGeneratorV2) Next() []int {
	for i := 0; i < 5; i++ {
		cg.data[i] = <-cg.c
	}

	return cg.data
}

and the test file:

import (
	"fmt"
	"testing"
)

func TestWsServerV2(t *testing.T) {
	combo3x3 := MakeCombGeneratorV2(3, 3, 3, 3, 3)
	combo3x3.Init(1)
	for h := 0; h < 50; h++ {
		if combo := combo3x3.Next(); len(combo) != 0 {
			i := 0
			combo := combo[2:]
			fmt.Println(combo)
			for x := 1; x <= 3; x++ {
				var hit = combo[i]
				fmt.Printf("[%d]", hit)
				i++
			}
		}
		fmt.Println("")
	}
}

Regards

heatblazer avatar Oct 14 '25 20:10 heatblazer

Hi, reels scanner is already implemented here, it placed at file game/slot/stat.go. Its the main task to calculate reels RTP. Every reels set in source code was calculated by it on development stage. The reels scanner is developed for high performance, so it working with processing in multithreading with synchronization by atomic-calls and by mutexes. Synchronization by channels looks good but it's not suitable for billions calls by performance issue. For example, if reels have 60 symbols length, there are will be 60x60x60x60x60 = 777 millions reshufles. And here reels calculated at few seconds in most common cases, you can test reels of any game by run at command line like slot_win_x64.exe -v scan -g=novomatic/wildhorses -r=95

schwarzlichtbezirk avatar Oct 15 '25 00:10 schwarzlichtbezirk

Hi, I haven't noticed that you have one. Great then. I've made a hi perf C++ estimator on the lines but it can't fit on go lang code since it's with OpenCL then it performs KDE testing for provable fairness, but I am running it on a remote machine since it takes some time to gather all data.

heatblazer avatar Oct 15 '25 07:10 heatblazer