示例#1
0
        public void UnityIoCContainerTest()
        {
            Console.WriteLine("“I know only 2 ways to beat roulette: steal chips from the table\n" +
                              "or open your own casino and put roulette there,” - Albert Einstein.\nNow we will check these words:\n");

            int gamesMustPlay = 42;

            IUnityContainer rouletteContainer = InitializeRouletteIoCContainer();

            Table         table  = rouletteContainer.Resolve <Table>();
            MartingaleBot martin = rouletteContainer.Resolve <MartingaleBot>("MartingaleBot");
            TitanicBot    titan  = rouletteContainer.Resolve <TitanicBot>("TitanicBot");
            BeginnerBot   begin  = rouletteContainer.Resolve <BeginnerBot>("BeginnerBot");

            Console.WriteLine();

            for (int i = 0; i < gamesMustPlay; i++)
            {
                table.SpinRoulette();

                martin.MakeBet();
                titan.MakeBet();
                begin.MakeBet();

                martin.DisplayInformation(gamesMustPlay);
                titan.DisplayInformation(gamesMustPlay);
                begin.DisplayInformation(gamesMustPlay);
            }

            Console.WriteLine($"\nThe cash balance of the table is {table.cashBalance}$.");
        }
示例#2
0
        public void MartingaleBotTest()
        {
            MartingaleBot MartingaleTest = new MartingaleBot();

            BetInfo.Balance = 5000;
            MartingaleTest.Action(400, 2);
        }
示例#3
0
        public void MartingaleBotActionAfterBlackjackTest()
        {
            var bot = new MartingaleBot(exampleStartMoney, exampleStartRate);

            bot.TakeCard(new UsualCard(CardNames.Ten, CardSuits.Diamond));
            bot.TakeCard(new AceCard(CardSuits.Diamond));
            bot.MakeNextPlayerTurn(new AceCard(CardSuits.Diamond));

            Assert.IsTrue(bot.PlayerTurnNow == PlayerTurn.Stand);
        }
示例#4
0
        public void RouletteTest()
        {
            Console.WriteLine("“I know only 2 ways to beat roulette: steal chips from the tableA\n" +
                              "or open your own casino and put roulette there,” - Albert Einstein.\nNow we will check these words:\n");

            int gamesMustPlay = 42;

            Table tableA = new Table();

            MartingaleBot martin = new MartingaleBot(tableA);
            TitanicBot    titan  = new TitanicBot(tableA);
            BeginnerBot   begin  = new BeginnerBot(tableA);

            Console.WriteLine();

            for (int i = 0; i < gamesMustPlay; i++)
            {
                tableA.SpinRoulette();

                martin.MakeBet();
                titan.MakeBet();
                begin.MakeBet();

                martin.DisplayInformation(gamesMustPlay);
                titan.DisplayInformation(gamesMustPlay);
                begin.DisplayInformation(gamesMustPlay);
            }

            Console.WriteLine($"\nThe cash balance of the tableA is {tableA.CashBalance}$.\n\n");

            Table tableB = new Table();

            MartingaleBot martinB = new MartingaleBot(tableB);
            TitanicBot    titanB  = new TitanicBot(tableB);
            BeginnerBot   beginB  = new BeginnerBot(tableB);

            Console.WriteLine();

            for (int i = 0; i < gamesMustPlay; i++)
            {
                tableB.SpinRoulette();

                martinB.MakeBet();
                titanB.MakeBet();
                beginB.MakeBet();

                martinB.DisplayInformation(gamesMustPlay);
                titanB.DisplayInformation(gamesMustPlay);
                beginB.DisplayInformation(gamesMustPlay);
            }

            Console.WriteLine($"\nThe cash balance of the tableB is {tableB.CashBalance}$.");
        }
示例#5
0
        public void GameWithMartingaleBotConstructorTest()
        {
            var firstBot  = new MartingaleBot(1000, minimumRate);
            var firstGame = new Game(firstBot);

            firstGame.CreateGame(countDecksInOne);

            Assert.IsNotNull(firstGame);
            Assert.IsNotNull(firstGame.Deck);
            Assert.IsNotNull(firstGame.Dealer);
            Assert.IsNotNull(firstGame.Bot);
            Assert.AreEqual(firstBot, firstGame.Bot);
        }
示例#6
0
        public void MartingaleBotNextGamePreparationTest()
        {
            var bot = new MartingaleBot(exampleStartMoney, exampleStartRate);

            bot.Lose();
            Assert.IsTrue(bot.Rate == exampleStartRate * 2);

            bot.Lose();
            Assert.IsTrue(bot.Rate == exampleStartRate * 4);

            bot.Win();
            Assert.IsTrue(bot.Rate == exampleStartRate);
        }
示例#7
0
        public void MartingaleBotPlayTest()
        {
            var firstBot  = new MartingaleBot(1000, minimumRate);
            var firstGame = new Game(firstBot);

            firstGame.CreateGame(countDecksInOne);

            int startCountOfCards = firstGame.Deck.Deck.Count();

            firstGame.CreateGame(countDecksInOne);

            Assert.DoesNotThrow(() => firstGame.StartGame());
            Assert.IsTrue(firstGame.Deck.Deck.Count() < startCountOfCards);
        }
示例#8
0
        static void Main(string[] agrs)
        {
            Console.WriteLine("This program show what balance you'll have after play Blackjack" +
                              "with one of the strategies: \n");

            int countGames               = 50000;
            int startMoney               = 10000;
            int startRate                = 500;
            int sumAfterGame             = 0;
            int countLoseAllBalanceGames = 0;

            // PrimitiveManchetanStrategyBot statistic

            for (int i = 0; i < countGames; i++)
            {
                PrimitiveManchetanStrategyBot bot = new PrimitiveManchetanStrategyBot(startMoney, startRate);
                Game game = new Game(bot);
                game.CreateGame(8);
                game.StartGame();
                sumAfterGame += (int)bot.Money;
                if (bot.Money <= 0)
                {
                    countLoseAllBalanceGames++;
                }
            }
            Console.WriteLine("1) PrimitiveManchetanStrategyBot statistic: ");
            Console.WriteLine($"Average winnings over 40 games ---> {sumAfterGame / 50000}/{startMoney} <--- Your start balance");
            Console.WriteLine("The number of games when a player loses his entire balance ---> " + countLoseAllBalanceGames);

            // MartingaleBot statistic
            sumAfterGame             = 0;
            countLoseAllBalanceGames = 0;

            for (int i = 0; i < countGames; i++)
            {
                MartingaleBot bot  = new MartingaleBot(startMoney, startRate);
                Game          game = new Game(bot);
                game.CreateGame(8);
                game.StartGame();
                sumAfterGame += (int)bot.Money;
                if (bot.Money <= 0)
                {
                    countLoseAllBalanceGames++;
                }
            }
            Console.WriteLine("2) MartingaleBot statistic: ");
            Console.WriteLine($"Average winnings over 40 games ---> {sumAfterGame / 50000}/{startMoney} <--- Your start balance");
            Console.WriteLine("The number of games when a player loses his entire balance ---> " + countLoseAllBalanceGames);

            // OneThreeTwoSixBot statistic
            sumAfterGame             = 0;
            countLoseAllBalanceGames = 0;

            for (int i = 0; i < countGames; i++)
            {
                OneThreeTwoSixBot bot = new OneThreeTwoSixBot(startMoney, startRate);
                Game game             = new Game(bot);
                game.CreateGame(8);
                game.StartGame();
                sumAfterGame += (int)bot.Money;
                if (bot.Money <= 0)
                {
                    countLoseAllBalanceGames++;
                }
            }
            Console.WriteLine("3) OneThreeTwoSixBot statistic: ");
            Console.WriteLine($"Average winnings over 40 games ---> {sumAfterGame / 50000}/{startMoney} <--- Your start balance");
            Console.WriteLine("The number of games when a player loses his entire balance ---> " + countLoseAllBalanceGames);

            Console.WriteLine("<----------------------------------------------->");
            return;
        }
示例#9
0
        public void MartingaleBotConstructorTest()
        {
            var bot = new MartingaleBot(exampleStartMoney, exampleStartRate);

            ConstructorTest(bot);
        }