public void AddBotsTest()
        {
            RouletteTable tableOne = new RouletteTable();

            Player playerOne = new BotDAlembert("TestBotDAlembert", 27000);

            tableOne.AddPlayer(playerOne);
            Assert.AreEqual(tableOne.Players.Count, 1);
            Assert.AreEqual(tableOne.Players[0], playerOne);
            Assert.AreEqual(tableOne.Players[0].Deposit, 27000);
            playerOne.ShowInfo();

            Player playerTwo = new BotLabouchere("TestBotLabouchere", 3000);

            tableOne.AddPlayer(playerTwo);
            Assert.AreEqual(tableOne.Players.Count, 2);
            Assert.AreEqual(tableOne.Players[1], playerTwo);
            Assert.AreEqual(tableOne.Players[1].Deposit, 3000);
            playerTwo.ShowInfo();

            Player playerThree = new BotMartingale("TestBotMartingale", 7000);

            tableOne.AddPlayer(playerThree);
            Assert.AreEqual(tableOne.Players.Count, 3);
            Assert.AreEqual(tableOne.Players[2], playerThree);
            Assert.AreEqual(tableOne.Players[2].Deposit, 7000);
            playerThree.ShowInfo();
        }
        public void SpinBotMartingaleTest()
        {
            RouletteTable tableOne  = new RouletteTable();
            Player        playerOne = new BotDAlembert("TestBotMartingaleOne", 0);

            tableOne.AddPlayer(playerOne);
            tableOne.Spin();
            Assert.AreEqual(tableOne.Observers[0], playerOne);

            Player playerTwo = new BotMartingale("TestBotMartingaleTwo", 3000);

            tableOne.AddPlayer(playerTwo);

            tableOne.Spin();
            tableOne.ShowInfoAboutPlayers();

            Assert.AreEqual(tableOne.Players[0].Name, "TestBotMartingaleTwo");
            Assert.AreEqual(tableOne.Players[0].AmountOfBets, 1);
            int oldBalance = tableOne.Players[0].Balance;

            tableOne.Spin();
            tableOne.ShowInfoAboutPlayers();

            Assert.AreEqual(tableOne.Players[0].AmountOfBets, 2);
            Assert.AreNotEqual(tableOne.Players[0].Balance, oldBalance);
        }
        public void MakeBetBotMartingaleTest()
        {
            RouletteTable tableOne = new RouletteTable();

            Player     newBot  = new BotMartingale("TestBotMartingaleOne", 0);
            List <Bet> newList = newBot.MakeBet(0);

            Assert.AreEqual(newList, null);

            Player playerTwo = new BotMartingale("TestBotMartingaleTwo", 15000);

            tableOne.AddPlayer(playerTwo);
            int bets = 0;

            newList = tableOne.Players[0].MakeBet(0);
            Assert.AreEqual(newList[0].Player, 0);
            int unit = playerTwo.Deposit / 40;

            Assert.AreEqual(newList[0].Money, unit);
            Assert.AreEqual(playerTwo.AmountOfBets, 0);

            while (tableOne.Observers.Count == 0)
            {
                tableOne.Spin();
                if (tableOne.Observers.Count == 0)
                {
                    bets++;
                }
                Assert.AreEqual(playerTwo.AmountOfBets, bets);
                Assert.AreEqual(playerTwo.Profit, playerTwo.Balance - 15000);
            }
            playerTwo.ShowInfo();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to LUCKY ROULETTE!");
            Console.WriteLine("");

            if (args.Length != 1)
            {
                Console.WriteLine("Incorrect amount of parameters. Only one needed.");
                return;
            }

            List <Type> bots = new BotLoader().FindBots(args[0], typeof(Bot));

            if (bots == null)
            {
                return;
            }

            RouletteTable tableOne = new RouletteTable();

            for (int x = 0; x < bots.Count; x++)
            {
                object[] parameters = { bots[x].Name, 1000 };
                tableOne.AddPlayer((Player)Activator.CreateInstance(bots[x], parameters));
            }

            for (int x = 0; x < 40; x++)
            {
                tableOne.Spin();
            }

            Console.WriteLine("");
            tableOne.ShowInfoAboutPlayers();
        }
Beispiel #5
0
        static void Main()
        {
            Console.WriteLine("Welcome to LUCKY ROULETTE!");
            Console.WriteLine("");

            RouletteTable tableOne = new RouletteTable();

            tableOne.AddPlayer(new BotDAlembert("BotDAlembert", 1000));
            tableOne.AddPlayer(new BotLabouchere("BotLabouchere", 1000));
            tableOne.AddPlayer(new BotMartingale("BotMartingale", 1000));

            for (int x = 0; x < 40; x++)
            {
                tableOne.Spin();
            }

            Console.WriteLine("");
            tableOne.ShowInfoAboutPlayers();
        }