static void Main() { var bots = BotsLoader.LoadBots("../../../../Plugins/BotsDlls"); Console.WriteLine( "This program implements blackjack with basic rules and 3 bots with different strategies.\n" + "Now will be launched 1000 gaming sessions of 40 draws and\n" + "will be calculated minimum, average and maximum balance of bots after this sessions.\n" ); foreach (var bot in bots) { if (bot is BaseStrategyBot) { Console.WriteLine("Bot with <<base>> strategy:"); } else if (bot is KellyCriterionBot) { Console.WriteLine("Bot with strategy based on <<Kelly criterion>>:"); } else if (bot is ThorpSystemBot) { Console.WriteLine("Bot with strategy based on <<Thorp system>>:"); } GamesLaunch(bot); } }
public void PluginConstructorTest() { BotsLoader loader = new BotsLoader(); Assert.AreEqual(0, loader.SuccessfullyLoadedBots); Assert.AreEqual(0, loader.NumberOfBots); }
public void LoadWithBadPathTest() { BotsLoader loader = new BotsLoader(); Assert.AreEqual(0, loader.Load("../../../../Plugins")); Assert.AreEqual(0, loader.SuccessfullyLoadedBots); Assert.AreEqual(0, loader.NumberOfBots); }
public void LoadWithGoodPathTest() { BotsLoader loader = new BotsLoader(); Assert.AreEqual(3, loader.Load("../../../../Plugins/Dlls/Bots.dll")); Assert.AreEqual(3, loader.SuccessfullyLoadedBots); Assert.AreEqual(3, loader.NumberOfBots); }
public void BadPathsLoadTest() { var bots = BotsLoader.LoadBots("../../../../BotsDlls"); Assert.IsEmpty(bots); bots = BotsLoader.LoadBots("../../../../../BlackJack/Plugins"); Assert.IsEmpty(bots); }
public void TakeBotsBadlyTest() { BotsLoader loader = new BotsLoader(); loader.Load("../../../../Plugins"); (List <IPlayer>, List <string>)bots = loader.TakeBots(); Assert.AreEqual(0, bots.Item1.Count); Assert.AreEqual(0, bots.Item2.Count); Assert.IsFalse(bots.Item2.Contains("HalvesBot")); Assert.IsFalse(bots.Item2.Contains("PlusMinusBot")); Assert.IsFalse(bots.Item2.Contains("StandartBot")); }
public void TakeBotsWellTest() { BotsLoader loader = new BotsLoader(); loader.Load("../../../../Plugins/Dlls/Bots.dll"); (List <IPlayer>, List <string>)bots = loader.TakeBots(); Assert.AreEqual(3, bots.Item1.Count); Assert.AreEqual(3, bots.Item2.Count); Assert.IsTrue(bots.Item2.Contains("HalvesBot")); Assert.IsTrue(bots.Item2.Contains("PlusMinusBot")); Assert.IsTrue(bots.Item2.Contains("StandartBot")); }
public void GoodPathLoadTest() { var bots = BotsLoader.LoadBots("../../../../../BlackJack/Plugins/BotsDlls"); Assert.AreEqual(3, bots.Count); Assert.AreEqual(1, bots.Count(x => x is BaseStrategyBot)); Assert.AreEqual(1, bots.Count(x => x is ThorpSystemBot)); Assert.AreEqual(1, bots.Count(x => x is KellyCriterionBot)); foreach (var bot in bots) { Assert.AreEqual(1000, bot.Balance); } }
private void Start() { AudioManager.Instance.Setup(); var audioSettingsLoader = new AudioSettingsLoader("Audio.data"); audioSettingsLoader.Load(); audioSettingsLoader.DeleteSaves(); var playerLoader = new PlayerLoader("Player.data"); var mapLoader = new MapLoader("Map.data"); var botsLoader = new BotsLoader("Bots.data"); ParameterManager.Instance.SetDefaults(); LoadSystem.AddLoader(playerLoader); LoadSystem.AddLoader(mapLoader); LoadSystem.AddLoader(botsLoader); }
private static void PlayWithPlugins(string?path) { BotsLoader loader = new BotsLoader(); CasinoLaunch casino; (List <IPlayer>, List <string>)bots; int length = loader.Load(path); bots = loader.TakeBots(); for (int i = 0; i < length; i++) { casino = new CasinoLaunch(bots.Item1[i], bots.Item2[i]); casino.StartCasino(); casino.PrintInfo(); } }