コード例 #1
0
        public void EngineShouldCreateWheel(int wheelWidth, int wheelHeight)
        {
            var spinResult = new PandaSpinResult()
                             .CreateWheel(wheelWidth, wheelHeight);

            Assert.IsNotNull(spinResult.Wheel);
        }
コード例 #2
0
        public void EngineShouldCreateCorrectWheelDimensions(int wheelWidth, int wheelHeight)
        {
            var spinResult = new PandaSpinResult()
                             .CreateWheel(wheelWidth, wheelHeight);

            Assert.AreEqual(wheelWidth, spinResult.Wheel.Width);
            Assert.AreEqual(wheelHeight, spinResult.Wheel.Height);
        }
コード例 #3
0
        public int EngineShouldCreateWinPositionLineNumber(string wheelString, int level, decimal bet, int betLevel)
        {
            var wheelValues  = Array.ConvertAll(wheelString.Split(','), Convert.ToInt32);
            var encodedWheel = EncodeWheel(Wheel.Width, Wheel.Height, wheelValues);

            var spinResult = new PandaSpinResult()
            {
                Wheel = encodedWheel
            }.CalculateWin(bet, betLevel);

            return(spinResult.WinPositions.FirstOrDefault().Line);
        }
コード例 #4
0
        public void EngineShouldNotCreateWinPositionsOnLose(string wheelString, int level, decimal bet, int betLevel)
        {
            var wheelValues  = Array.ConvertAll(wheelString.Split(','), Convert.ToInt32);
            var encodedWheel = EncodeWheel(Wheel.Width, Wheel.Height, wheelValues);

            var spinResult = new PandaSpinResult()
            {
                Wheel = encodedWheel
            }.CalculateWin(bet, betLevel);

            Assert.IsNull(spinResult.WinPositions.FirstOrDefault());
        }
コード例 #5
0
        public decimal EngineShouldReturnCorrectPayout(string wheelString, int level, decimal bet, int betLevel)
        {
            var wheelValues  = Array.ConvertAll(wheelString.Split(','), Convert.ToInt32);
            var encodedWheel = EncodeWheel(Wheel.Width, Wheel.Height, wheelValues);

            var spinResult = new PandaSpinResult()
            {
                Wheel = encodedWheel
            }
            .CalculateWin(bet, betLevel);

            return(spinResult.Win);
        }
コード例 #6
0
ファイル: Panda.cs プロジェクト: dangkim/KairosUpgrade3.1
        public void TestFullCycle(int level, int betLines)
        {
            var timeStart        = DateTime.Now;
            var module           = GetModule();
            var targetRtpLevel   = Math.Round(Config.RtpLevels.FirstOrDefault(rl => rl.Level == level && rl.Multiplier == betLines).Rtp, 2);
            var totalSummaryData = new SummaryData();

            var ugk = new UserGameKey()
            {
                UserId = -1,
                GameId = module.GameId,
                Level  = 888
            };

            var reelStrip = Config.LevelReels
                            .FirstOrDefault(lr => lr.Level == level)
                            .ReelStrips
                            .FirstOrDefault(rs => rs.BetLines == betLines);

            reelStrip.Symbols[0].ForEach(sym1 =>
            {
                reelStrip.Symbols[1].ForEach(sym2 =>
                {
                    reelStrip.Symbols[2].ForEach(sym3 =>
                    {
                        var spinResult = new PandaSpinResult()
                        {
                            SpinBet = new SpinBet(ugk, PlatformType.None)
                            {
                                Lines      = Config.Lines,
                                Multiplier = betLines,
                                LineBet    = 1
                            },
                            Wheel = GetFullCycleWheel(Config.Lines, new List <int> {
                                sym1, sym2, sym3
                            })
                        }
                        .CalculateWin(1, betLines);

                        totalSummaryData.Update(spinResult);
                    });
                });
            });

            totalSummaryData.DisplayData(level, timeStart, targetRtpLevel);
            var resultOverallRtp = Math.Round(totalSummaryData.RtpData.OverallRtp, 2);

            var isRtpEquivalent = resultOverallRtp == targetRtpLevel;

            Assert.True(isRtpEquivalent, $"RTP not matching. The result is {resultOverallRtp}.");
        }
コード例 #7
0
ファイル: Panda.cs プロジェクト: dangkim/KairosUpgrade3.1
        public void TestBets(int gameId, int level, string currencyCode, int numOfUsers, int numItrPerUser, decimal bet, int lines, int mp)
        {
            var timeStart        = DateTime.Now;
            var module           = GetModule();
            var targetRtpLevel   = Config.RtpLevels.FirstOrDefault(rl => rl.Level == level && rl.Multiplier == mp).Rtp;
            var totalSummaryData = new SummaryData();

            var users    = GenerateUsers(gameId, numOfUsers, level);
            var spinBets = GenerateUserBets(users, bet, 0, lines, mp);

            Parallel.ForEach(users,
                             () => new SummaryData(),
                             (key, state, summaryData) =>
            {
                var spinBet = spinBets[key.UserId];
                for (var i = 0; i < numItrPerUser; i++)
                {
                    var spinResult = new PandaSpinResult()
                    {
                        SpinBet = spinBet
                    }
                    .CreateWheel(Config.Wheel.Width, Config.Wheel.Height)
                    .GenerateRandomWheel(Config.Wheels, level, mp)

                    .CalculateWin(bet, mp);

                    summaryData.Update(spinResult);
                }

                return(summaryData);
            },
                             sdata => { lock (totalSummaryData) { totalSummaryData.Sum(sdata); } });

            totalSummaryData.DisplayData(level, timeStart, targetRtpLevel);
            totalSummaryData.DisplayPayoutsData(bet, lines);

            var isWithinRtp = totalSummaryData.RtpData.OverallRtp >= targetRtpLevel - 1 && totalSummaryData.RtpData.OverallRtp <= targetRtpLevel + 1;

            Assert.True(isWithinRtp, $"RTP not matching. The result is {totalSummaryData.RtpData.OverallRtp}.");
        }