public void TestBonusBuilder() { // arrange var user = new UserGameKey(-1, 109); var requestContext = new RequestContext <SpinArgs>("simulation", "Cleopatra", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; var userSession = new UserSession { SessionKey = "unittest" }; var spinArgs = new SpinArgs { LineBet = 1, Multiplier = 1 }; requestContext.Parameters = spinArgs; requestContext.UserSession = userSession; var freeSpinWheel = new FortuneChimesWheel { Reels = new List <int[]> { new [] { 0, 1, 2 }, new [] { 0, 10, 1 }, new [] { 0, 10, 3 }, new [] { 0, 10, 2 }, new [] { 2, 3, 4 } } }; var explodingWheel = new FortuneChimesWheel { Reels = new List <int[]> { new [] { 0, 1, 2 }, new [] { 0, 4, 1 }, new [] { 0, 10, 3 }, new [] { 0, 10, 2 }, new [] { 2, 3, 4 } } }; // Action var freeSpin = GameReduce.DoSpin(1, requestContext, freeSpinWheel); var expoding = GameReduce.DoSpin(1, requestContext, explodingWheel); // Assert Assert.IsTrue(freeSpin.HasBonus); Assert.IsTrue(freeSpin.Bonus.ClientId == 3); Assert.IsTrue(freeSpin.Bonus.Count == 14); Assert.IsTrue(expoding.HasBonus); Assert.IsTrue(expoding.Bonus.ClientId == 4); Assert.IsTrue(expoding.Bonus.Count == 1); }
public void TestSpin() { // Arrange var user = new UserGameKey(-1, 51); var requestContext = new RequestContext <SpinArgs>("simulation", "FortuneKoi", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; var userSession = new UserSession { SessionKey = "unittest" }; var spinArgs = new SpinArgs { LineBet = 1, Multiplier = 1 }; requestContext.Parameters = spinArgs; requestContext.UserSession = userSession; var wheel = new FortuneKoiWheel { Reels = new List <int[]> { new [] { 0, 1, 2 }, new [] { 0, 10, 1 }, new [] { 0, 10, 3 }, new [] { 0, 10, 2 }, new [] { 2, 3, 4 } } }; // Action var result = GameReduce.DoSpin(1, requestContext, wheel); var responseXml = xmlhelper.Serialize(result.ToResponseXml(ResponseXmlFormat.None)); var element = XElement.Parse(responseXml, LoadOptions.PreserveWhitespace); var xelement = result.ToXElement(); // Assert Assert.IsTrue(result.ToString() != null); Assert.IsTrue(result.XmlType == XmlType.SpinXml); Assert.IsTrue(result.GameResultType == GameResultType.SpinResult); Assert.IsNotNull(element); Assert.IsNotNull(xelement); Assert.IsTrue(element.Element("wheels") != null); Assert.IsTrue(element.Element("wheels").Attribute("val") != null); Assert.AreEqual(element.Element("wheels").Attribute("val").Value, "0,1,2,0,10,1,0,10,3,0,10,2,2,3,4"); Assert.IsTrue(element.Element("win") != null); Assert.AreEqual(result.Win, decimal.Parse(element.Element("win").Value)); Assert.IsTrue(element.Element("winposition") != null); Assert.AreEqual(result.HasBonus, element.Element("bonus") != null); Assert.AreEqual(result.HasBonus, element.Element("bonusposition") != null); }
public void TestSpin() { // Arrange var user = new UserGameKey(-1, 109); var requestContext = new RequestContext <SpinArgs>("simulation", "Cleopatra", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; var userSession = new UserSession { SessionKey = "unittest" }; var spinArgs = new SpinArgs { LineBet = 1, Multiplier = 1 }; requestContext.Parameters = spinArgs; requestContext.UserSession = userSession; var wheel = new FortuneChimesWheel { Reels = new List <int[]> { new [] { 0, 1, 2 }, new [] { 0, 10, 1 }, new [] { 0, 10, 3 }, new [] { 0, 10, 2 }, new [] { 2, 3, 4 } } }; // Action var result = GameReduce.DoSpin(1, requestContext, wheel); var responseXml = xmlhelper.Serialize(result.ToResponseXml(ResponseXmlFormat.None)); var element = XElement.Parse(responseXml, LoadOptions.PreserveWhitespace); // Assert Assert.IsNotNull(element); Assert.IsTrue(element.Element("wheels") != null); Assert.AreEqual(wheel.Reels.Select(ele => string.Join(',', ele)).Aggregate((s1, s2) => string.Join(',', s1, s2)), element.Element("wheels").Attribute("val").Value); Assert.AreEqual(result.Win > 0, element.Element("win") != null); Assert.AreEqual(result.Win, decimal.Parse(element.Element("win").Value)); Assert.AreEqual(result.Win > 0, element.Element("winposition") != null); Assert.AreEqual(result.HasBonus, element.Element("bonus") != null); Assert.AreEqual(result.HasBonus, element.Element("bonusposition") != null); }
public void FullCycle(int level, decimal spinBet) { var strips = Slot.Games.FortuneChimes.Configuration.Config.MainGameReelStrip[0]; var reel1 = strips[0]; var reel2 = strips[1]; var reel3 = strips[2]; var reel4 = strips[3]; var reel5 = strips[4]; var user = new UserGameKey(-1, 109) { Level = level }; var summData = new SummaryData(); var sdt = DateTime.Now; var spinArgs = new SpinArgs { LineBet = spinBet, Multiplier = 1 }; var request = user.CreateRequestContext <SpinArgs>("fortunechimes"); for (int i1 = 0; i1 < reel1.Count; i1++) { for (int i2 = 0; i2 < reel2.Count; i2++) { for (int i3 = 0; i3 < reel3.Count; i3++) { for (int i4 = 0; i4 < reel4.Count; i4++) { for (int i5 = 0; i5 < reel5.Count; i5++) { request.Parameters = spinArgs; var r1 = reel1.TakeCircular(i1, 3).ToArray(); var r2 = reel2.TakeCircular(i2, 3).ToArray(); var r3 = reel3.TakeCircular(i3, 3).ToArray(); var r4 = reel4.TakeCircular(i4, 3).ToArray(); var r5 = reel5.TakeCircular(i5, 3).ToArray(); if (i1 == 2 && i2 == i3 && i3 == i4 && i4 == 9) { } var wheel = new FortuneChimesWheel { Reels = new List <int[]> { r1, r2, r3, r4, r5 }, Indices = new int[] { i1, i2, i3, i4, i5 } }; summData.SpinCounter++; summData.TotalBet += Slot.Games.FortuneChimes.Configuration.Config.Lines * spinBet; var result = GameReduce.DoSpin(level, request, wheel); var scatterPayout = result.WinPositions.Where(ele => ele.Line == 0 && ele.Symbol == 10).Sum(item => item.Win); summData.MainGameScatterWin += scatterPayout; summData.MainGameNoneScatterWin += result.Win - scatterPayout; if (scatterPayout > 0) { summData.MgFHit++; } if (result.HasBonus) { var bonus = result.Bonus; var bonusRequest = user.CreateRequestContext <BonusArgs>("fortunechimes"); var typeOfBonus = bonus.ClientId; switch (typeOfBonus) { case 4: case 5: summData.MgExplodingHit++; break; case 3: summData.MgFHit++; break; default: throw new Exception(); } summData += ExecuteBonus(level, bonusRequest, result); } } } } } } var edt = DateTime.Now; var oldOut = Console.Out; var fileStream = new FileStream($@"..\..\..\Results\FortuneChimes\{TestContext.CurrentContext.Test.Name}.txt", FileMode.OpenOrCreate, FileAccess.Write); var writer = new StreamWriter(fileStream); Console.SetOut(writer); Console.WriteLine(String.Format("Test.Level : {0}", level)); Console.WriteLine(String.Format("Test.TimeStart : {0} {1}", sdt.ToShortDateString(), sdt.ToLongTimeString())); Console.WriteLine(String.Format("Test.TimeEnd : {0} {1}", edt.ToShortDateString(), edt.ToLongTimeString())); Console.WriteLine(String.Format("SpinCount : {0}", summData.SpinCounter)); Console.WriteLine(String.Format("TotalBet : {0,12:0.00}", summData.TotalBet)); Console.WriteLine("----------------------------------------"); Console.WriteLine(String.Format("Exploding Hit Rate (MG) : {0,12:0.00}", summData.MgExplodingHitRate)); Console.WriteLine(String.Format("MG Feature Hit Rate : {0,12:0.00}", summData.MgFHitRate)); Console.WriteLine(String.Format("MG Scatter ReSpin Hit : {0,12:0.00}", summData.MgScatterReSpinFHit)); Console.WriteLine(String.Format("MG None Scatter ReSpin Hit : {0,12:0.00}", summData.MgNoneScatterReSpinFHit)); Console.WriteLine(String.Format("MG ReSpin Feature Hit Rate : {0,12:0.00}", summData.MgReSpinFHitRate)); //Console.WriteLine(String.Format("MG Avg Feature Hit Rate : {0,12:0.00}", summData)); Console.WriteLine(String.Format("Exploding Feature Hit Rate : {0,12:0.00}", summData.MgExplodingFHitRate)); Console.WriteLine(String.Format("Exploding Hit Rate (FG) : {0,12:0.00}", summData.FgExplodingHitRate)); Console.WriteLine(String.Format("Reveal Hit Rate (FG) : {0,12:0.00}", summData.FgRevealHitRate)); Console.WriteLine(String.Format("MG Scatter Win : {0,12:0.00}", summData.MainGameScatterWin)); Console.WriteLine(String.Format("MG None Scatter Win : {0,12:0.00}", summData.MainGameNoneScatterWin)); Console.WriteLine(String.Format("MG ReSpin Scatter Win : {0,12:0.00}", summData.MgScatterExplodingWin)); Console.WriteLine(String.Format("MG ReSpin None Scatter Win : {0,12:0.00}", summData.MgNonScatterExplodingWin)); Console.WriteLine(String.Format("MG Reveal Win : {0,12:0.00}", summData.MgRevealWin)); Console.WriteLine(String.Format("FG Win : {0,12:0.00}", summData.FSTotalWin)); Console.WriteLine(String.Format("FG Exploding Win : {0,12:0.00}", summData.FgExplodingWin)); Console.WriteLine(String.Format("FG Reveal Win : {0,12:0.00}", summData.FgRevealWin)); Console.WriteLine("----------------------------------------"); if (summData.TotalBet > 0) { Console.WriteLine(String.Format("MG Scatter RTP : {0,11:0.00000000000000000000000000}%", 100 * summData.MainGameScatterWin / summData.TotalBet)); Console.WriteLine(String.Format("MG None Scatter RTP : {0,11:0.00000000000000000000000000}%", 100 * summData.MainGameNoneScatterWin / summData.TotalBet)); Console.WriteLine(String.Format("MG ReSpin Scatter RTP : {0,11:0.00000000000000000000000000}%", 100 * summData.MgScatterExplodingWin / summData.TotalBet)); Console.WriteLine(String.Format("MG ReSpin None Scatter RTP : {0,11:0.00000000000000000000000000}%", 100 * summData.MgNonScatterExplodingWin / summData.TotalBet)); Console.WriteLine(String.Format("MG Reveal RTP : {0,11:0.00000000000000000000000000}%", 100 * summData.MgRevealWin / summData.TotalBet)); Console.WriteLine(String.Format("FG RTP : {0,11:0.00}%", 100 * summData.FSTotalWin / summData.TotalBet)); Console.WriteLine(String.Format("FG Exploding RTP : {0,11:0.00}%", 100 * summData.FgExplodingWin / summData.TotalBet)); Console.WriteLine(String.Format("FG Reveal RTP : {0,11:0.00}%", 100 * summData.FgRevealWin / summData.TotalBet)); } Console.WriteLine("--- RTP.OverAll ------------------------"); Console.WriteLine(String.Format("RTP.Total (Over All) : {0,11:0.0000}%", 100 * summData.RTPOverAll)); Console.SetOut(oldOut); writer.Close(); fileStream.Close(); Console.WriteLine($"Max Collapse {maxCollapse}"); Console.WriteLine("Done"); }