public void EngineShouldGetRemoveCorrectRowPositions(string wheelString, int level) { var config = new Configuration(); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString.ToFormattedWheelString()); var winPositions = MainGameEngine.GenerateWinPositions(config.Payline, config.PayTable, wheel, 1, 1); var removedWinPositions = CollapsingBonusEngine.GetRemoveWinPositions(winPositions); for (var widthIndex = 0; widthIndex < wheel.Width; widthIndex++) { for (var heightIndex = 0; heightIndex < Game.WheelHeight; heightIndex++) { var index = (widthIndex * Game.WheelHeight) + heightIndex; var removeRowPositions = CollapsingBonusEngine.GetRemoveRowPositions(winPositions, index); var removeWinPositions = winPositions .Select(wp => wp.RowPositions[index] > 0 ? index % Game.WheelWidth : -1) .Where(wp => wp != -1) .Distinct(); var targetRowPositions = removeWinPositions; Assert.IsTrue(!targetRowPositions.Except(removeRowPositions).Any()); } } }
public void EngineShouldGetRemoveCorrectRowPositions(string wheelString, int level) { var config = new Configuration(); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString.ToFormattedWheelString()); var winPositions = MainGameEngine.GenerateWinPositions( config.Payline, config.PayTable, wheel, 1, Game.Lines, config.BonusConfig.Collapse.Multipliers.First()); var bonusPositions = MainGameEngine.GenerateBonusPositions(wheel); var removedWinPositions = CollapsingBonusEngine.GetRemoveWinPositions(winPositions, bonusPositions); for (var widthIndex = 0; widthIndex < wheel.Width; widthIndex++) { var removeRowPositions = CollapsingBonusEngine.GetRemoveRowPositions(winPositions, widthIndex); var removeWinPositions = winPositions .Select(wp => wp.RowPositions[widthIndex] - 1) .Where(wp => wp != -1) .Distinct(); var targetRowPositions = removeWinPositions; Assert.IsTrue(!targetRowPositions.Except(removeRowPositions).Any()); } }
public void EngineShouldGetRemoveCorrectRowPositions(string wheelString, int level) { var config = new Configuration(); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString); var winPositions = MainGameEngine.GenerateWinPositions( config.Payline, config.PayTable, wheel, 1, Game.Lines, 1); var matchingSymbolPositions = MainGameEngine.GenerateMatchingSymbolPositions(config.SymbolCollapsePairs, winPositions.Select(wp => wp.Symbol).ToList(), wheel); var bombAndStopperPositions = MainGameEngine.GenerateBombAndStopperPositions(wheel, winPositions); var removedWinPositions = CollapsingBonusEngine.GetRemoveWinPositions(winPositions); for (var widthIndex = 0; widthIndex < wheel.Width; widthIndex++) { var removeRowPositions = CollapsingBonusEngine.GetRemoveRowPositions(winPositions, matchingSymbolPositions, bombAndStopperPositions, widthIndex); var removeWinPositions = winPositions .Select(wp => wp.RowPositions[widthIndex] - 1) .Where(wp => wp != -1) .Distinct(); var removeMatchingSymbolPositions = matchingSymbolPositions[widthIndex] .Select(position => position - 1) .Where(position => position != -1) .Distinct(); var targetRowPositions = removeWinPositions.Union(removeMatchingSymbolPositions); Assert.IsTrue(!targetRowPositions.Except(removeRowPositions).Any()); } }
public void EngineShouldGetCorrectCollapseRemoveItems(string wheelString, int level) { var config = new Configuration(); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString.ToFormattedWheelString()); var winPositions = MainGameEngine.GenerateWinPositions(config.Payline, config.PayTable, wheel, 1, 1); var removedWinPositions = CollapsingBonusEngine.GetRemoveWinPositions(winPositions); var collapsingRemoves = CollapsingBonusEngine.GetCollapseRemoveItems(removedWinPositions); for (var widthIndex = 0; widthIndex < wheel.Width; widthIndex++) { var removeRowPositionsCollection = new List <int>(); for (var heightIndex = 0; heightIndex < Game.WheelHeight; heightIndex++) { var index = (widthIndex * Game.WheelHeight) + heightIndex; var removeRowPositions = CollapsingBonusEngine.GetRemoveRowPositions(removedWinPositions, index); removeRowPositionsCollection.AddRange(removeRowPositions); } Assert.IsTrue(!collapsingRemoves[widthIndex].Except(removeRowPositionsCollection).Any()); } }
public void EngineShouldGetCorrectCollapseRemoveItems(string wheelString, int level) { var config = new Configuration(); var wheel = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString.ToFormattedWheelString()); var winPositions = MainGameEngine.GenerateWinPositions( config.Payline, config.MainGamePayTable, wheel, 1, Game.Lines, 1); var bonusPositions = MainGameEngine.GenerateBonusPositions(wheel); var removedWinPositions = CollapsingBonusEngine.GetRemoveWinPositions(winPositions, bonusPositions); var collapsingRemoves = CollapsingBonusEngine.GetCollapseRemoveItems(removedWinPositions); for (var widthIndex = 0; widthIndex < wheel.Width; widthIndex++) { var removeRowPositions = CollapsingBonusEngine.GetRemoveRowPositions(removedWinPositions, widthIndex); Assert.IsTrue(!collapsingRemoves[widthIndex].Except(removeRowPositions).Any()); } }