public static int Main(string[] argv) { ConsoleMessages.SendGreetings(); if (argv.Length != 1) { return(ConsoleMessages.SendError(1, "unexcpected amount of arguments; please pass only one path")); } var players = PlayerLoader.LoadFromDLL(argv[0]); if (players == null) { return(ConsoleMessages.SendError(-1, $"could not load .dll from the given path: {argv[0]}")); } StandartDealer dealer = new(); int initialStack = 40000; int roundsPerGame = 40; int gameCycles = 1000; foreach (var player in players) { StatCollector.RunBlackjackGame(dealer, player, player.GetType().ToString(), initialStack, roundsPerGame, gameCycles).PrintMainData(Console.OpenStandardOutput()); Console.WriteLine(); } return(0); }
public static int Main() { ConsoleMessages.SendGreeitngs(); RandomPlayer random = new(); Hit17Player hit17 = new(); BasicStrategyPlayer basic = new(); StandartDealer dealer = new(); int initialStack = 40000; int roundsPerGame = 40; int gameCycles = 1000; StatCollector.RunBlackjackGame(dealer, random, "RandomPlayerTest", initialStack, roundsPerGame, gameCycles).PrintMainData(Console.OpenStandardOutput()); Console.WriteLine(); StatCollector.RunBlackjackGame(dealer, hit17, "Hit17PlayerTest", initialStack, roundsPerGame, gameCycles).PrintMainData(Console.OpenStandardOutput()); Console.WriteLine(); StatCollector.RunBlackjackGame(dealer, basic, "BasicStrategyTest", initialStack, roundsPerGame, gameCycles).PrintMainData(Console.OpenStandardOutput()); return(0); }
public void SimpleAverageWinsOnTieTest() { DummyDealer dealer = new(); PlayerAlwaysHit player = new(); StatContainer stat = StatCollector.RunBlackjackGame(dealer, player, "test", 1000, 2, 2); Assert.AreEqual(0, stat.AverageWins); }
public void SimpleAverageWinsTest() { DealerStackDoubler dealer = new(); PlayerAlwaysHit player = new(); StatContainer stat = StatCollector.RunBlackjackGame(dealer, player, "test", 1000, 1, 2); Assert.AreEqual(1000, stat.AverageReturn); }
public void NoErrorPrintTest() { DummyDealer dealer = new(); PlayerAlwaysHit player = new(); StatContainer stat = StatCollector.RunBlackjackGame(dealer, player, "test", 1000, 1, 1); byte[] data = new byte[1000]; using (MemoryStream ms = new MemoryStream(data)) { Assert.AreEqual(0, stat.PrintMainData(ms)); } }