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 expandedWheel = ExpandingWildsEngine.GenerateWheelWithExpandedWilds(wheel, config); var winPositions = MainGameEngine.GenerateWinPositions( config.Payline, config.PayTable, expandedWheel, spinBet.LineBet, spinBet.Lines, 1); var spinResult = new SpinResult(spinBet, wheel, winPositions); return(spinResult.Win); }
public string EngineShouldCreateCorrectRowPositions(string wheelString, int level) { var config = new Configuration(); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString.ToFormattedWheelString()); var expandedWheel = ExpandingWildsEngine.GenerateWheelWithExpandedWilds(wheel, config); var winPositions = MainGameEngine.GenerateWinPositions( config.Payline, config.PayTable, expandedWheel, 1, Game.Lines, 1); return(string.Join('|', winPositions.Select(wp => string.Join(',', wp.RowPositions)))); }
public void EngineShouldCreateCorrectWinPositionLineAndMultiplierAndSymbol(string wheelString, int level) { var config = new Configuration(); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString.ToFormattedWheelString()); var expandedWheel = ExpandingWildsEngine.GenerateWheelWithExpandedWilds(wheel, config); var winPositions = MainGameEngine.GenerateWinPositions( config.Payline, config.PayTable, expandedWheel, 1, Game.Lines, 1); Assert.IsTrue(!winPositions.Any(wp => wp.Line < 0 || wp.Multiplier <= 0 || wp.Symbol < 0)); }
public int EngineShouldCreateCorrectWinPositionCount(string wheelString, int level) { var config = new Configuration(); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString.ToFormattedWheelString()); var expandedWheel = ExpandingWildsEngine.GenerateWheelWithExpandedWilds(wheel, config); var winPositions = MainGameEngine.GenerateWinPositions( config.Payline, config.PayTable, expandedWheel, 1, Game.Lines, 1); return(winPositions.Count); }
public string EngineShouldExpandVerticalWildSymbolCorrectly(int widthIndex, int heightIndex) { var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight); for (var columnIndex = 0; columnIndex < Game.WheelWidth; columnIndex++) { wheel.Reels[columnIndex].AddRange(Enumerable.Repeat(0, Game.WheelHeight)); } wheel.Reels[widthIndex][heightIndex] = Symbols.WildVertical; ExpandingWildsEngine.ExpandWildVerticalSymbol(wheel, widthIndex, heightIndex); SpinsHelper.DisplayWheelOnOutput(wheel); var expandedCoordinates = SpinsHelper.GetWildCoordinates(wheel, Symbols.Wild); return(string.Join('|', expandedCoordinates)); }
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}"); }