public void TestFullCycle(int gameId, int level) { var timeStart = DateTime.Now; var module = SimulationHelper.GetModule(gameId); var configuration = new Configuration(); var targetRtpLevel = Math.Round(configuration.RtpLevels.FirstOrDefault(rl => rl.Level == level).Rtp, 2); var totalSummaryData = new SummaryData(); var spinRequestContext = SimulationHelper.GetMockSpinRequestContext(gameId); var bonusRequestContext = SimulationHelper.GetMockBonusRequestContext(gameId, 0); var targetWheel = MainGameEngine.GetTargetWheel(level, configuration); var userGameKey = new UserGameKey() { UserId = -1, GameId = gameId, Level = level }; var spinBet = MainGameEngine.GenerateSpinBet(spinRequestContext); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight); for (var reel1 = 0; reel1 < targetWheel[0].Count; reel1++) { for (var reel2 = 0; reel2 < targetWheel[1].Count; reel2++) { for (var reel3 = 0; reel3 < targetWheel[2].Count; reel3++) { wheel.Reels[0] = SimulationHelper.GetReelRange(targetWheel[0], reel1); wheel.Reels[1] = SimulationHelper.GetReelRange(targetWheel[1], reel2); wheel.Reels[2] = SimulationHelper.GetReelRange(targetWheel[2], reel3); var topIndices = new List <int> { reel1, reel2, reel3 }; var winPositions = MainGameEngine.GenerateWinPositions(configuration.Payline, configuration.PayTable, wheel, spinBet.LineBet, spinBet.Lines, spinBet.Multiplier); var stackedReels = MainGameEngine.GetStackedReels(wheel, configuration.PayTable); var bonusPositions = MainGameEngine.GenerateBonusPositions(stackedReels); var spinResult = new SpinResult(spinBet, wheel, winPositions, bonusPositions) { PlatformType = spinRequestContext.Platform, Level = level }; totalSummaryData.Update(spinResult); if (spinResult.HasBonus) { var bonus = module.CreateBonus(spinResult).Value; while (!bonus.IsCompleted) { var bonusResult = SimulationHelper.ExecuteBonus(level, bonus, bonusRequestContext, configuration).Value; totalSummaryData.UpdateBonus(bonusResult); bonus = bonusResult.Bonus; } } } } } totalSummaryData.DisplayData(level, timeStart, targetRtpLevel); var resultOverallRtp = Math.Round(totalSummaryData.RtpData.OverallRtp, 2); var isWithinRtp = totalSummaryData.RtpData.OverallRtp >= targetRtpLevel - 0.5m && totalSummaryData.RtpData.OverallRtp <= targetRtpLevel + 0.5m; Assert.True(isWithinRtp, $"RTP not matching. The result is {resultOverallRtp}. Expected is {targetRtpLevel}"); }
public void TestMainGameFullCycle(int gameId, int level, string reelStripId) { var timeStart = DateTime.Now; var module = SimulationHelper.GetModule(gameId); var configuration = new Configuration(); var targetRtpLevel = Math.Round(configuration.RtpLevels.FirstOrDefault(rl => rl.Level == level).Rtp, 2); var totalSummaryData = new SummaryData(); var spinRequestContext = SimulationHelper.GetMockSpinRequestContext(gameId); var bonusRequestContext = SimulationHelper.GetMockBonusRequestContext(0, gameId); var targetWheel = MainGameEngine.GetTargetWheel(level, configuration, reelStripId); var userGameKey = new UserGameKey() { UserId = -1, GameId = gameId, Level = level }; var spinBet = MainGameEngine.GenerateSpinBet(spinRequestContext); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight) { ReelStripsId = reelStripId }; for (var reel1 = 0; reel1 < targetWheel[0].Count; reel1++) { for (var reel2 = 0; reel2 < targetWheel[1].Count; reel2++) { for (var reel3 = 0; reel3 < targetWheel[2].Count; reel3++) { for (var reel4 = 0; reel4 < targetWheel[3].Count; reel4++) { for (var reel5 = 0; reel5 < targetWheel[4].Count; reel5++) { wheel.Reels[0] = SimulationHelper.GetReelRange(targetWheel[0], reel1); wheel.Reels[1] = SimulationHelper.GetReelRange(targetWheel[1], reel2); wheel.Reels[2] = SimulationHelper.GetReelRange(targetWheel[2], reel3); wheel.Reels[3] = SimulationHelper.GetReelRange(targetWheel[3], reel4); wheel.Reels[4] = SimulationHelper.GetReelRange(targetWheel[4], reel5); var topIndices = MainGameEngine.GenerateRandomWheelIndices(targetWheel); var stackedReels = MainGameEngine.GetStackedSymbols(wheel); var bonusPositions = MainGameEngine.GenerateBonusPositions(wheel); var hasWildStackedReels = stackedReels.Any(sr => sr.Symbol == Symbols.Wild); var multiplier = hasWildStackedReels ? configuration.StackedWildMultiplier : spinBet.Multiplier; if (stackedReels.Any(sr => sr.Symbol == Symbols.Mystery)) /// Calculate wins with replaced mystery symbols { var replacementSymbol = MainGameEngine.GetMysterySymbolReplacement(configuration.MysterySymbolReplacementWeights); var replacedMysterySymbolWheel = MainGameEngine.GenerateReplacedMysterySymbolWheel(configuration, wheel, replacementSymbol); var winPositions = MainGameEngine.GenerateWinPositions( configuration.Payline, configuration.PayTable, replacedMysterySymbolWheel, spinBet.LineBet, spinBet.Lines, multiplier); var spinResult = new SpinResult(level, spinBet, wheel, winPositions, bonusPositions, multiplier, replacementSymbol); totalSummaryData.Update(spinResult); } else /// Calculate wins with initial wheel { var winPositions = MainGameEngine.GenerateWinPositions( configuration.Payline, configuration.PayTable, wheel, spinBet.LineBet, spinBet.Lines, multiplier); var spinResult = new SpinResult(level, spinBet, wheel, winPositions, bonusPositions, multiplier); totalSummaryData.Update(spinResult); } } } } } } totalSummaryData.DisplayData(level, timeStart, targetRtpLevel); var resultOverallRtp = Math.Round(totalSummaryData.RtpData.OverallRtp, 2); var isWithinRtp = totalSummaryData.RtpData.OverallRtp >= targetRtpLevel - 0.5m && totalSummaryData.RtpData.OverallRtp <= targetRtpLevel + 0.5m; Assert.True(isWithinRtp, $"RTP not matching. The result is {resultOverallRtp}. Expected is {targetRtpLevel}"); }
public void TestFreeGameFullCycle(int gameId, int level) { var timeStart = DateTime.Now; var module = SimulationHelper.GetModule(gameId); var configuration = new Configuration(); var targetRtpLevel = Math.Round(configuration.RtpLevels.FirstOrDefault(rl => rl.Level == level).Rtp, 2); var totalSummaryData = new SummaryData(); var requestContext = SimulationHelper.GetMockSpinRequestContext(gameId); var bonusRequestContext = SimulationHelper.GetMockBonusRequestContext(gameId, 0); var targetWheel = MainGameEngine.GetTargetWheel(level, configuration); var userGameKey = new UserGameKey() { UserId = -1, GameId = gameId, Level = level }; var mockSpinResult = MainGameEngine.CreateSpinResult(level, requestContext, configuration); var spinBet = MainGameEngine.GenerateSpinBet(bonusRequestContext, mockSpinResult, FreeSpin.Multiplier); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight); for (var reel1 = 0; reel1 < targetWheel[0].Count; reel1++) { for (var reel2 = 0; reel2 < targetWheel[1].Count; reel2++) { for (var reel3 = 0; reel3 < targetWheel[2].Count; reel3++) { for (var reel4 = 0; reel4 < targetWheel[3].Count; reel4++) { for (var reel5 = 0; reel5 < targetWheel[4].Count; reel5++) { wheel.Reels[0] = SimulationHelper.GetReelRange(targetWheel[0], reel1); wheel.Reels[1] = SimulationHelper.GetReelRange(targetWheel[1], reel2); wheel.Reels[2] = SimulationHelper.GetReelRange(targetWheel[2], reel3); wheel.Reels[3] = SimulationHelper.GetReelRange(targetWheel[3], reel4); wheel.Reels[4] = SimulationHelper.GetReelRange(targetWheel[4], reel5); var topIndices = new List <int> { reel1, reel2, reel3, reel4, reel5 }; var winPositions = MainGameEngine.GenerateWinPositions(configuration.Payline, configuration.PayTable, wheel, spinBet.LineBet, spinBet.Lines, spinBet.Multiplier); var matchingSymbolPositions = MainGameEngine.GenerateMatchingSymbolPositions(configuration.SymbolCollapsePairs, winPositions.Select(wp => wp.Symbol).ToList(), wheel); var bombAndStopperPositions = MainGameEngine.GenerateBombAndStopperPositions(wheel, winPositions); var spinResult = new SpinResult(level, spinBet, wheel, topIndices, winPositions, matchingSymbolPositions, bombAndStopperPositions) { PlatformType = bonusRequestContext.Platform, Level = level }; totalSummaryData.Update(spinResult); if (spinResult.HasBonus) { var bonus = module.CreateBonus(spinResult).Value; while (!bonus.IsCompleted) { if (bonus is RevealBonus) { bonusRequestContext = SimulationHelper.GetMockBonusRequestContext(gameId, RandomNumberEngine.Next(Reveal.RandomWeightMinRange, Reveal.RandomWeightMaxRange)); } var bonusResult = SimulationHelper.ExecuteBonus(level, bonus, bonusRequestContext, configuration).Value; totalSummaryData.UpdateBonus(bonusResult); bonus = bonusResult.Bonus; } } } } } } } totalSummaryData.DisplayData(level, timeStart, targetRtpLevel); var resultOverallRtp = Math.Round(totalSummaryData.RtpData.OverallRtp, 2); var isWithinRtp = totalSummaryData.RtpData.OverallRtp >= targetRtpLevel - 0.5m && totalSummaryData.RtpData.OverallRtp <= targetRtpLevel + 0.5m; Assert.True(isWithinRtp, $"RTP not matching. The result is {resultOverallRtp}. Expected is {targetRtpLevel}"); }
public void FullCycle(int gameId, int level) { var timeStart = DateTime.Now; var module = SimulationHelper.GetModule(gameId); var configuration = module.Configuration; var targetRtpLevel = Math.Round(configuration.RtpLevels.FirstOrDefault(rl => rl.Level == level).Rtp, 2); var totalSummaryData = new SummaryData(); var spinRequestContext = SimulationHelper.GetMockSpinRequestContext(gameId); var targetWheel = MainGameEngine.GetTargetWheel(level, configuration); var userGameKey = new UserGameKey() { UserId = -1, GameId = gameId, Level = level }; var spinBet = MainGameEngine.GenerateSpinBet(spinRequestContext); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight); for (var reel1 = 0; reel1 < targetWheel[0].Count; reel1++) { for (var reel2 = 0; reel2 < targetWheel[1].Count; reel2++) { for (var reel3 = 0; reel3 < targetWheel[2].Count; reel3++) { for (var reel4 = 0; reel4 < targetWheel[3].Count; reel4++) { for (var reel5 = 0; reel5 < targetWheel[4].Count; reel5++) { wheel.Reels[0] = SimulationHelper.GetReelRange(targetWheel[0], reel1); wheel.Reels[1] = SimulationHelper.GetReelRange(targetWheel[1], reel2); wheel.Reels[2] = SimulationHelper.GetReelRange(targetWheel[2], reel3); wheel.Reels[3] = SimulationHelper.GetReelRange(targetWheel[3], reel4); wheel.Reels[4] = SimulationHelper.GetReelRange(targetWheel[4], reel5); var expandedWheel = ExpandingWildsEngine.GenerateWheelWithExpandedWilds(wheel, configuration); var winPositions = MainGameEngine.GenerateWinPositions( configuration.Payline, configuration.PayTable, expandedWheel, spinBet.LineBet, spinBet.Lines, spinBet.Multiplier); var spinResult = new SpinResult(spinBet, wheel, winPositions) { PlatformType = spinRequestContext.Platform, Level = level }; totalSummaryData.Update(spinResult); } } } } } totalSummaryData.DisplayData(level, timeStart, targetRtpLevel); var resultOverallRtp = Math.Round(totalSummaryData.RtpData.OverallRtp, 2); var isWithinRtp = totalSummaryData.RtpData.OverallRtp >= targetRtpLevel - 0.5m && totalSummaryData.RtpData.OverallRtp <= targetRtpLevel + 0.5m; Assert.True(isWithinRtp, $"RTP not matching. The result is {resultOverallRtp}. Expected is {targetRtpLevel}"); }
public void TestFreeGameFullCycle(int gameId, int level, string reelStripId) { var timeStart = DateTime.Now; var module = SimulationHelper.GetModule(gameId); var configuration = new Configuration(); var targetRtpLevel = Math.Round(configuration.RtpLevels.FirstOrDefault(rl => rl.Level == level).Rtp, 2); var totalSummaryData = new SummaryData(); var spinRequestContext = SimulationHelper.GetMockSpinRequestContext(gameId); var bonusRequestContext = SimulationHelper.GetMockBonusRequestContext(0, gameId); var targetWheel = MainGameEngine.GetTargetWheel(level, configuration, reelStripId); var userGameKey = new UserGameKey() { UserId = -1, GameId = gameId, Level = level }; var spinBet = MainGameEngine.GenerateSpinBet(spinRequestContext); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight) { ReelStripsId = reelStripId }; for (var reel1 = 0; reel1 < targetWheel[0].Count; reel1++) { for (var reel2 = 0; reel2 < targetWheel[1].Count; reel2++) { for (var reel3 = 0; reel3 < targetWheel[2].Count; reel3++) { for (var reel4 = 0; reel4 < targetWheel[3].Count; reel4++) { for (var reel5 = 0; reel5 < targetWheel[4].Count; reel5++) { wheel.Reels[0] = SimulationHelper.GetReelRange(targetWheel[0], reel1); wheel.Reels[1] = SimulationHelper.GetReelRange(targetWheel[1], reel2); wheel.Reels[2] = SimulationHelper.GetReelRange(targetWheel[2], reel3); wheel.Reels[3] = SimulationHelper.GetReelRange(targetWheel[3], reel4); wheel.Reels[4] = SimulationHelper.GetReelRange(targetWheel[4], reel5); var topIndices = new List <int> { reel1, reel2, reel3, reel4, reel5 }; var avalancheMultiplier = configuration.BonusConfig.FreeSpin.Multipliers.First(); var winPositions = MainGameEngine.GenerateWinPositions(configuration.Payline, configuration.PayTable, wheel, spinBet.LineBet, spinBet.Lines, avalancheMultiplier); var bonusPositions = MainGameEngine.GenerateBonusPositions(wheel); var spinResult = new SpinResult(spinBet, wheel, topIndices, winPositions, bonusPositions, avalancheMultiplier) { PlatformType = spinRequestContext.Platform, Level = level }; totalSummaryData.Update(spinResult); if (spinResult.HasBonus) { var bonus = module.CreateBonus(spinResult).Value; if (bonus is FreeSpinBonus) { bonus = CollapsingBonusEngine.CreateCollapsingSpinBonus(spinResult); } var collapsingSpinBonus = bonus as CollapsingSpinBonus; while (!bonus.IsCompleted) { var previousSpinResult = collapsingSpinBonus.PreviousGameResult == null ? collapsingSpinBonus.SpinResult : collapsingSpinBonus.PreviousSpinResult; var referenceWheel = MainGameEngine.GetTargetWheel(level, configuration, previousSpinResult.Wheel.ReelStripsId); var collapsingSpinResult = CollapsingBonusEngine.CreateCollapsingSpinResult( previousSpinResult, referenceWheel, configuration.BonusConfig.FreeSpin.Multipliers, configuration.Payline, configuration.PayTable); collapsingSpinBonus.UpdateBonus(collapsingSpinResult); var bonusResult = CollapsingBonusEngine.CreateCollapsingBonusResult(collapsingSpinBonus, collapsingSpinResult); totalSummaryData.UpdateBonus(bonusResult); bonus = bonusResult.Bonus; } } } } } } } totalSummaryData.DisplayData(level, timeStart, targetRtpLevel); var resultOverallRtp = Math.Round(totalSummaryData.RtpData.OverallRtp, 2); var isWithinRtp = totalSummaryData.RtpData.OverallRtp >= targetRtpLevel - 0.5m && totalSummaryData.RtpData.OverallRtp <= targetRtpLevel + 0.5m; Assert.True(isWithinRtp, $"RTP not matching. The result is {resultOverallRtp}. Expected is {targetRtpLevel}"); }