public string EngineShouldCreateCorrectCollapseReels(string wheelString, string indicesString, int level) { var config = new Configuration(); var spinBet = MainGameEngine.GenerateSpinBet(new RequestContext <SpinArgs>("", "", PlatformType.Web) { GameSetting = new Model.Entity.GameSetting { GameSettingGroupId = 0 }, Currency = new Model.Entity.Currency { Id = 0 }, Parameters = new SpinArgs { LineBet = 1, Multiplier = 1 } }); var targetWheel = config.Wheels.FirstOrDefault().Value; var topIndices = Array.ConvertAll(indicesString.Split(','), Convert.ToInt32).ToList(); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString.ToFormattedWheelString()); var winPositions = MainGameEngine.GenerateWinPositions(config.Payline, config.PayTable, wheel, spinBet.LineBet, 1); var spinResult = new SpinResult(spinBet, wheel, topIndices, winPositions); var collapsingSpinResult = CollapsingBonusEngine.CreateCollapsingSpinResult(spinResult, targetWheel, config.Payline, config.PayTable); return(string.Join('|', collapsingSpinResult.Wheel.Reels.Select(symbols => string.Join(',', symbols)))); }
public decimal SpinResultShouldCreateCorrectPayout(string wheelString, int level, decimal bet) { var config = new Configuration(); var spinBet = MainGameEngine.GenerateSpinBet(new RequestContext <SpinArgs>("", "", PlatformType.Web) { GameSetting = new Model.Entity.GameSetting { GameSettingGroupId = 0 }, Currency = new Model.Entity.Currency { Id = 0 }, Parameters = new SpinArgs { LineBet = bet, Multiplier = 1 } }); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString.ToFormattedWheelString()); var winPositions = MainGameEngine.GenerateWinPositions(config.Payline, config.PayTable, wheel, spinBet.LineBet, 1); var spinResult = new SpinResult(spinBet, wheel, null, winPositions); return(spinResult.Win); }
public void TestMainGameFullCycle(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(0, 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++) { 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.Multiplier); var spinResult = new SpinResult(spinBet, wheel, topIndices, winPositions) { 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}"); }