예제 #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";
        }
        public void resetTable()
        {
            deck.initDeck();
            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);
            flop        = new List <MyCard.Card>(3);
            foreach (Player.Player p in players)
            {
                if (p.cash != 0)
                {
                    p.setCards(deck.getCard(), deck.getCard());
                    p.folded    = false;
                    p.playerBet = 0;
                }
                else
                {
                    p.folded = true;
                }
            }

            // movePos();
            flop.Add(deck.getCard());
            flop.Add(deck.getCard());
            flop.Add(deck.getCard());
            river = deck.getCard();
            turn  = deck.getCard();
        }
 public override void setCards(MyCard.Card c1, MyCard.Card c2)
 {
     cards        = new List <MyCard.Card>(2);
     c1.CardImage = Properties.Resources.back;
     c2.CardImage = Properties.Resources.back;
     cards.Add(c1);
     cards.Add(c2);
 }
예제 #5
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();
            }
        }
        public void initDeck()
        {
            // Resets deck with cards
            Cards = new List<Dynamic_Games.IncInformation.Cards.Card>(52);
            String symbol = "c";
            String nameHelper;
            Bitmap img;
            Dynamic_Games.IncInformation.Cards.Card tmpCard;
            for (int i = 0; i < 4; i++)
            {
                //c -> treff
                //d -> rombusz
                //h -> sziv
                //s -> pikk
                for (int num = 1; num <= 9; num++)
                {
                    nameHelper = symbol + "0" + num.ToString();
                    img = (Bitmap)Properties.Resources.ResourceManager.GetObject(nameHelper);
                    tmpCard = new Card(nameHelper, img);
                    Cards.Add(tmpCard);
                }
                for (int num = 10; num <= 13; num++)
                {
                    nameHelper = symbol + num.ToString();
                    img = (Bitmap)Properties.Resources.ResourceManager.GetObject(nameHelper);
                    tmpCard = new Card(nameHelper, img);
                    Cards.Add(tmpCard);
                }
                switch (symbol)
                {
                    case "c":
                        symbol = "d";
                        break;
                    case "d":
                        symbol = "h";
                        break;
                    case "h":
                        symbol = "s";
                        break;
                }

            }
        }
예제 #7
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);
        }
예제 #8
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);
        }
        private string cardToString(MyCard.Card card)
        {
            string cardname = "error";

            if (card.CardName[1] == '0')
            {
                if (card.CardName[2] == '1')
                {
                    cardname = "a" + card.CardName[0].ToString();
                }
                else
                {
                    cardname = card.CardName[2].ToString() + card.CardName[0].ToString();
                }
            }
            else
            {
                if (card.CardName[2] == '0')
                {
                    cardname = "T" + card.CardName[0].ToString();
                }
                if (card.CardName[2] == '1')
                {
                    cardname = "j" + card.CardName[0].ToString();
                }
                if (card.CardName[2] == '2')
                {
                    cardname = "q" + card.CardName[0].ToString();
                }
                if (card.CardName[2] == '3')
                {
                    cardname = "k" + card.CardName[0].ToString();
                }
            }

            return(cardname);
        }
 public void swapCard(ref MyCard.Card c1, ref MyCard.Card c2)
 {
     MyCard.Card temp = c1;
     c1 = c2;
     c2 = temp;
 }
예제 #11
0
 public override void setCards(MyCard.Card c1, MyCard.Card c2)
 {
     cards = new List <MyCard.Card>(2);
     cards.Add(c1);
     cards.Add(c2);
 }
예제 #12
0
        public void resetTable()
        {
            deck.initDeck();
            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);
            flop = new List<MyCard.Card>(3);
            foreach (Player.Player p in players)
            {
                if (p.cash != 0)
                {
                    p.setCards(deck.getCard(), deck.getCard());

                    p.folded = false;
                    p.playerBet = 0;
                }
                else
                {
                    p.folded = true;
                }
            }

            // movePos();
            flop.Add(deck.getCard());
            flop.Add(deck.getCard());
            flop.Add(deck.getCard());
            river = deck.getCard();
            turn = deck.getCard();
        }
예제 #13
0
 public abstract void setCards(MyCard.Card c1, MyCard.Card c2);