コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public void BadPathsLoadTest()
        {
            var bots = BotsLoader.LoadBots("../../../../BotsDlls");

            Assert.IsEmpty(bots);

            bots = BotsLoader.LoadBots("../../../../../BlackJack/Plugins");

            Assert.IsEmpty(bots);
        }
コード例 #3
0
        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);
            }
        }