-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47d1d60
commit 0fb46d0
Showing
14 changed files
with
641 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package extraspin | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"time" | ||
|
||
"github.com/slotopol/server/game/slot" | ||
) | ||
|
||
func CalcStat(ctx context.Context, mrtp float64) float64 { | ||
var reels, _ = slot.FindReels(ReelsMap, mrtp) | ||
var g = NewGame() | ||
var sln float64 = 1 | ||
g.Sel = int(sln) | ||
var s slot.Stat | ||
|
||
var dur = slot.ScanReels5x(ctx, &s, g, reels, | ||
time.Tick(5*time.Second), time.Tick(2*time.Second)) | ||
|
||
var reshuf = float64(s.Reshuffles) | ||
var lrtp, srtp = s.LinePay / reshuf / sln * 100, s.ScatPay / reshuf / sln * 100 | ||
var rtpsym = lrtp + srtp | ||
var q = float64(s.FreeCount) / reshuf | ||
var sq = 1 / (1 - q) | ||
var rtpfs = sq * rtpsym * 3 | ||
var rtp = rtpsym + q*rtpfs | ||
fmt.Printf("completed %.5g%%, selected %d lines, time spent %v\n", reshuf/float64(s.Planned())*100, g.Sel, dur) | ||
fmt.Printf("reels lengths [%d, %d, %d, %d, %d], total reshuffles %d\n", | ||
len(reels.Reel(1)), len(reels.Reel(2)), len(reels.Reel(3)), len(reels.Reel(4)), len(reels.Reel(5)), reels.Reshuffles()) | ||
fmt.Printf("symbols: %.5g(lined) + %.5g(scatter) = %.6f%%\n", lrtp, srtp, rtpsym) | ||
fmt.Printf("free spins %d, q = %.5g, sq = 1/(1-q) = %.6f\n", s.FreeCount, q, sq) | ||
fmt.Printf("free games frequency: 1/%.5g\n", reshuf/float64(s.FreeHits)) | ||
fmt.Printf("RTP = %.5g(sym) + %.5g*%.5g(fg) = %.6f%%\n", rtpsym, q, rtpfs, rtp) | ||
return rtp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//go:build !prod || full || agt | ||
|
||
package extraspin | ||
|
||
import ( | ||
"github.com/slotopol/server/game" | ||
) | ||
|
||
var Info = game.GameInfo{ | ||
Aliases: []game.GameAlias{ | ||
{Prov: "AGT", Name: "Extra Spin"}, | ||
}, | ||
GP: game.GPsel | | ||
game.GPretrig | | ||
game.GPfgmult | | ||
game.GPscat | | ||
game.GPwild, | ||
SX: 5, | ||
SY: 3, | ||
SN: len(LinePay), | ||
LN: len(BetLines), | ||
BN: 0, | ||
RTP: game.MakeRtpList(ReelsMap), | ||
} | ||
|
||
func init() { | ||
Info.SetupFactory(func() any { return NewGame() }, CalcStat) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
package extraspin | ||
|
||
// See: https://demo.agtsoftware.com/games/agt/extraspin | ||
|
||
import ( | ||
"github.com/slotopol/server/game/slot" | ||
) | ||
|
||
// Lined payment. | ||
var LinePay = [9][5]float64{ | ||
{0, 10, 50, 250, 1000}, // 1 wild | ||
{}, // 2 scatter | ||
{0, 0, 40, 120, 500}, // 3 strawberry | ||
{0, 0, 20, 40, 200}, // 4 papaya | ||
{0, 0, 20, 40, 200}, // 5 grapes | ||
{0, 0, 10, 20, 100}, // 6 orange | ||
{0, 0, 10, 20, 100}, // 7 plum | ||
{0, 0, 5, 10, 50}, // 8 cherry | ||
{0, 0, 5, 10, 50}, // 9 pear | ||
} | ||
|
||
// Bet lines | ||
var BetLines = slot.BetLinesAgt5x3[:10] | ||
|
||
type Game struct { | ||
slot.Slot5x3 `yaml:",inline"` | ||
} | ||
|
||
// Declare conformity with SlotGame interface. | ||
var _ slot.SlotGame = (*Game)(nil) | ||
|
||
func NewGame() *Game { | ||
return &Game{ | ||
Slot5x3: slot.Slot5x3{ | ||
Sel: len(BetLines), | ||
Bet: 1, | ||
}, | ||
} | ||
} | ||
|
||
const wild, scat = 1, 2 | ||
|
||
func (g *Game) Scanner(screen slot.Screen, wins *slot.Wins) { | ||
g.ScanLined(screen, wins) | ||
g.ScanScatters(screen, wins) | ||
} | ||
|
||
// Lined symbols calculation. | ||
func (g *Game) ScanLined(screen slot.Screen, wins *slot.Wins) { | ||
for li := 1; li <= g.Sel; li++ { | ||
var line = BetLines[li-1] | ||
|
||
var numw, numl slot.Pos = 0, 5 | ||
var syml slot.Sym | ||
var x slot.Pos | ||
for x = 1; x <= 5; x++ { | ||
var sx = screen.Pos(x, line) | ||
if sx == wild { | ||
if syml == 0 { | ||
numw = x | ||
} | ||
} else if syml == 0 && sx != scat { | ||
syml = sx | ||
} else if sx != syml { | ||
numl = x - 1 | ||
break | ||
} | ||
} | ||
|
||
var payw, payl float64 | ||
if numw > 0 { | ||
payw = LinePay[wild-1][numw-1] | ||
} | ||
if numl > 0 && syml > 0 { | ||
payl = LinePay[syml-1][numl-1] | ||
} | ||
if payl > payw { | ||
var mm float64 = 1 // mult mode | ||
if g.FSR > 0 { | ||
mm = 3 | ||
} | ||
*wins = append(*wins, slot.WinItem{ | ||
Pay: g.Bet * payl, | ||
Mult: mm, | ||
Sym: syml, | ||
Num: numl, | ||
Line: li, | ||
XY: line.CopyL(numl), | ||
}) | ||
} else if payw > 0 { | ||
var mm float64 = 1 // mult mode | ||
if g.FSR > 0 { | ||
mm = 3 | ||
} | ||
*wins = append(*wins, slot.WinItem{ | ||
Pay: g.Bet * payw, | ||
Mult: mm, | ||
Sym: wild, | ||
Num: numw, | ||
Line: li, | ||
XY: line.CopyL(numw), | ||
}) | ||
} | ||
} | ||
} | ||
|
||
// Scatters calculation. | ||
func (g *Game) ScanScatters(screen slot.Screen, wins *slot.Wins) { | ||
if count := screen.ScatNum(scat); count >= 1 { | ||
*wins = append(*wins, slot.WinItem{ | ||
Sym: scat, | ||
Num: count, | ||
XY: screen.ScatPos(scat), | ||
Free: int(count), | ||
}) | ||
} | ||
} | ||
|
||
func (g *Game) Spin(screen slot.Screen, mrtp float64) { | ||
var reels, _ = slot.FindReels(ReelsMap, mrtp) | ||
screen.Spin(reels) | ||
} | ||
|
||
func (g *Game) SetSel(sel int) error { | ||
return g.SetSelNum(sel, len(BetLines)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
local path = arg[0]:match("(.*[/\\])") | ||
dofile(path.."lib/reelgen.lua") | ||
|
||
local symset15 = { | ||
2, -- 1 wild | ||
0, -- 2 scatter (always 0 here) | ||
3, -- 3 strawberry | ||
4, -- 4 papaya | ||
4, -- 5 grapes | ||
7, -- 6 orange | ||
7, -- 7 plum | ||
8, -- 8 cherry | ||
8, -- 9 pear | ||
} | ||
|
||
local symset234 = { | ||
4, -- 1 wild | ||
1, -- 2 scatter (always 1 here) | ||
6, -- 3 strawberry | ||
10, -- 4 papaya | ||
10, -- 5 grapes | ||
13, -- 6 orange | ||
13, -- 7 plum | ||
15, -- 8 cherry | ||
15, -- 9 pear | ||
} | ||
|
||
local chunklen15 = { | ||
1, -- 1 wild | ||
1, -- 2 scatter | ||
1, -- 3 strawberry | ||
1, -- 4 papaya | ||
1, -- 5 grapes | ||
3, -- 6 orange | ||
3, -- 7 plum | ||
3, -- 8 cherry | ||
3, -- 9 pear | ||
} | ||
|
||
local chunklen234 = { | ||
1, -- 1 wild | ||
1, -- 2 scatter | ||
1, -- 3 strawberry | ||
1, -- 4 papaya | ||
1, -- 5 grapes | ||
7, -- 6 orange | ||
7, -- 7 plum | ||
5, -- 8 cherry | ||
5, -- 9 pear | ||
} | ||
|
||
math.randomseed(os.time()) | ||
local reel, iter | ||
reel, iter = makereelhot(symset15, 3, {[1]=true, [2]=true}, chunklen15, true) | ||
printreel(reel, iter) | ||
reel, iter = makereelhot(symset234, 3, {[1]=true, [2]=true}, chunklen234, true) | ||
printreel(reel, iter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.