Exemplo n.º 1
0
        public Table(MyCard.Deck d, int playerCount, IncInformationForm incForm)
        {
            folded = false;
            deal = new Deal(this);
            this.controls = incForm;
            riverHidden = new MyCard.Card("unknown", Properties.Resources.back);
            turnHidden = new MyCard.Card("unknown", Properties.Resources.back);
            flopH1 = new MyCard.Card("unknown", Properties.Resources.back);
            flopH2 = new MyCard.Card("unknown", Properties.Resources.back);
            flopH3 = new MyCard.Card("unknown", Properties.Resources.back);
            this.deck = d;
            this.bigBlind = 50;
            this.smallBlind = 25;
            this.playerCount = playerCount;

            for (int i = 0; i < playerCount; i++)
            {
                players.Add(new Player.HumanPlayer(1000, i, this));
                players.ElementAt(i).setCards(deck.getCard(), deck.getCard());
                players.ElementAt(i).setPos(Player.Position.None);
            }
            players[0].setPos(Player.Position.SmallBlind);
            smallBLoc = 0;
            controls.playerVis[0].typeLBL.Text += "SB";
            players[1].setPos(Player.Position.BigBlind);
            bigBLoc = 1;
            controls.playerVis[1].typeLBL.Text += "BB";
        }
        public Table(MyCard.Deck d, int playerCount, IncInformationForm incForm)
        {
            folded          = false;
            deal            = new Deal(this);
            this.controls   = incForm;
            riverHidden     = new MyCard.Card("unknown", Properties.Resources.back);
            turnHidden      = new MyCard.Card("unknown", Properties.Resources.back);
            flopH1          = new MyCard.Card("unknown", Properties.Resources.back);
            flopH2          = new MyCard.Card("unknown", Properties.Resources.back);
            flopH3          = new MyCard.Card("unknown", Properties.Resources.back);
            this.deck       = d;
            this.bigBlind   = 50;
            this.smallBlind = 25;

            for (int i = 0; i < playerCount; i++)
            {
                // players.Add(new Player.AIPlayer(1000, i, this,new Parameters(0)));
                Player.HumanPlayer hp = new Player.HumanPlayer(1000, i, this);
                players.Add(new Player.HumanPlayer(1000, i, this));
                players.ElementAt(i).setCards(deck.getCard(), deck.getCard());
                players.ElementAt(i).setPos(Player.Position.None);
            }
            players[0].setPos(Player.Position.SmallBlind);
            smallBLoc = 0;
            // controls.playerVis[0].typeLBL.Text += "SB";
            players[1].setPos(Player.Position.BigBlind);
            bigBLoc = 1;
            // controls.playerVis[1].typeLBL.Text += "BB";
        }
Exemplo n.º 3
0
        public void Table_resetFolds_IsCorrect()
        {
            var deck = new Deck();
            var incInformationForm = new IncInformationForm();
            var table   = new Table(deck, 2, incInformationForm);
            var players = new List <Player>();

            players.Add(new HumanPlayer(0, 1, table));
            players.Add(new HumanPlayer(0, 1, table));
            table.startTable(players);
            foreach (var player in table.players)
            {
                player.folded = true;
            }
            foreach (var player in table.players)
            {
                player.cash = 1000;
            }
            table.resetFolds();

            foreach (var player in table.players)
            {
                if (player.folded)
                {
                    Assert.Fail();
                }
            }
        }
Exemplo n.º 4
0
        public void TestDivisionCards_IncInformationForm_Visualize()
        {
            bool result = true;
            IncInformationForm testForm = new IncInformationForm();

            testForm.table.resetTable();
            testForm.vizualize();
            if (testForm.Flop1.Image != testForm.table.flop[0].CardImage)
            {
                result = false;
            }
            if (testForm.Flop2.Image != testForm.table.flop[1].CardImage)
            {
                result = false;
            }
            if (testForm.Flop3.Image != testForm.table.flop[2].CardImage)
            {
                result = false;
            }
            if (testForm.River.Image != testForm.table.river.CardImage)
            {
                result = false;
            }
            if (testForm.Turn.Image != testForm.table.turn.CardImage)
            {
                result = false;
            }
            Assert.IsTrue(result);
        }
Exemplo n.º 5
0
        public void HumanPlayer_setPosition_IncInformation()
        {
            var deck = new Deck();
            var incInformationForm = new IncInformationForm();
            var table       = new Table(deck, 2, incInformationForm);
            var humanPlayer = new HumanPlayer(1000, 0, table);

            humanPlayer.setPos(new Position());

            if (humanPlayer.pos.Equals(null))
            {
                Assert.Fail();
            }
        }
Exemplo n.º 6
0
        public void Table_swapCards_IsCorrect()
        {
            var deck = new Deck();
            var incInformationForm = new IncInformationForm();
            var table = new Table(deck, 2, incInformationForm);
            var card1 = new Dynamic_Games.IncInformation.Cards.Card("back1", Dynamic_Games.Properties.Resources.black);
            var card2 = new Dynamic_Games.IncInformation.Cards.Card("back2", Dynamic_Games.Properties.Resources.black);

            table.swapCard(ref card1, ref card2);

            if (!(card1.CardName == "back2" && card2.CardName == "back1"))
            {
                Assert.Fail();
            }
        }
Exemplo n.º 7
0
        public void AiPlayer_setPosition_IncInformation()
        {
            var deck = new Deck();
            var incInformationForm = new IncInformationForm();
            var table      = new Table(deck, 2, incInformationForm);
            var parameters = new Parameters(1);
            var aiPlayer   = new AIPlayer(1000, 0, table, parameters);

            aiPlayer.setPos(new Position());

            if (aiPlayer.pos.Equals(null))
            {
                Assert.Fail();
            }
        }
Exemplo n.º 8
0
        public void Table_startTable_IsCorrect()
        {
            var deck = new Deck();
            var incInformationForm = new IncInformationForm();
            var table   = new Table(deck, 2, incInformationForm);
            var players = new List <Player>();

            players.Add(new HumanPlayer(1000, 1, table));
            players.Add(new HumanPlayer(1000, 1, table));
            table.startTable(players);

            if (table.players.Count != 2)
            {
                Assert.Fail();
            }
        }
Exemplo n.º 9
0
        public void CardTest()
        {
            bool result = true;
            IncInformationForm testForm = new IncInformationForm();

            if (testForm.Flop1.Image != testForm.table.flop[0].CardImage)
            {
                result = false;
            }
            if (testForm.Flop2.Image != testForm.table.flop[1].CardImage)
            {
                result = false;
            }
            if (testForm.Flop3.Image != testForm.table.flop[2].CardImage)
            {
                result = false;
            }
            if (testForm.River.Image != testForm.table.river.CardImage)
            {
                result = false;
            }
            if (testForm.Turn.Image != testForm.table.turn.CardImage)
            {
                result = false;
            }
            int i = 0;

            foreach (Dynamic_Games.IncInformation.Player.Player p in testForm.table.players)
            {
                if (testForm.cardIterator[i].Image != p.cards[0].CardImage)
                {
                    result = false;
                }
                if (testForm.cardIterator[i + 1].Image != p.cards[1].CardImage)
                {
                    result = false;
                }
                i += 2;
            }
            Assert.IsTrue(result);
        }
Exemplo n.º 10
0
        public void HumanPlayer_setCards_IncInformation()
        {
            var deck = new Deck();
            var incInformationForm = new IncInformationForm();
            var table       = new Table(deck, 2, incInformationForm);
            var humanPlayer = new HumanPlayer(1000, 0, table);
            var card1       = new Dynamic_Games.IncInformation.Cards.Card("back1", Dynamic_Games.Properties.Resources.black);
            var card2       = new Dynamic_Games.IncInformation.Cards.Card("back2", Dynamic_Games.Properties.Resources.black);

            humanPlayer.setCards(card1, card2);

            if (card1 != humanPlayer.cards[0])
            {
                Assert.Fail();
            }
            if (card2 != humanPlayer.cards[1])
            {
                Assert.Fail();
            }
            Assert.IsTrue(true);
        }
Exemplo n.º 11
0
        public void AIPlayer_setCards_IncInformation()
        {
            var deck = new Deck();
            var incInformationForm = new IncInformationForm();
            var table           = new Table(deck, 2, incInformationForm);
            var parameters      = new Parameters(1);
            var aiPlayer        = new AIPlayer(1000, 0, table, parameters);
            var cardForAiPlayer = new Dynamic_Games.IncInformation.Cards.Card("back", null);
            var card            = new Dynamic_Games.IncInformation.Cards.Card("back", Dynamic_Games.Properties.Resources.back);

            aiPlayer.setCards(cardForAiPlayer, cardForAiPlayer);

            if (card.CardName != aiPlayer.cards[0].CardName || card.CardImage.Size != aiPlayer.cards[0].CardImage.Size)
            {
                Assert.Fail();
            }
            if (card.CardName != aiPlayer.cards[0].CardName || card.CardImage.Size != aiPlayer.cards[1].CardImage.Size)
            {
                Assert.Fail();
            }
            Assert.IsTrue(true);
        }
Exemplo n.º 12
0
        public void Test_PlayerCards_IncInformationForm_Visualize()
        {
            bool result = true;
            IncInformationForm testForm = new IncInformationForm();

            testForm.table.resetTable();
            testForm.vizualize();
            int i = 0;

            foreach (var p in testForm.table.players)
            {
                if (testForm.cardIterator[i].Image.Size != (p.cards[0].CardImage.Size))
                {
                    result = false;
                }
                if (testForm.cardIterator[i + 1].Image.Size != (p.cards[0].CardImage.Size))
                {
                    result = false;
                }
                i += 2;
            }
            Assert.IsTrue(result);
        }