Exemplo n.º 1
0
        private void NewDealer()
        {
            List <Card> cardsDealer  = new List <Card>();
            List <Card> cardsDealer2 = new List <Card>();

            dealer = new BlackJackDealer(cardsDealer, cardsDealer2);
            blackJackDeck.dealerDraw(dealer, 2);
            HouseCardList_ListBox.ItemsSource = null;
            HouseCardList_ListBox.ItemsSource = dealer.DealerHand;
        }
Exemplo n.º 2
0
        private void TestingMethod()
        {
            PlayerList = new List <Player>();
            List <Card> cards1       = new List <Card>();
            List <Card> cards2       = new List <Card>();
            List <Card> cards3       = new List <Card>();
            List <Card> cards4       = new List <Card>();
            List <Card> cards5       = new List <Card>();
            List <Card> cardsDealer  = new List <Card>();
            List <Card> cardsDealer2 = new List <Card>();

            cards1.Add(new Card(CardSuit.Clubs, CardValue.Ace, true));
            cards1.Add(new Card(CardSuit.Spades, CardValue.Six, true));
            cards2.Add(new Card(CardSuit.Clubs, CardValue.Two, true));
            cards2.Add(new Card(CardSuit.Spades, CardValue.Queen, true));
            cards3.Add(new Card(CardSuit.Clubs, CardValue.Jack, true));
            cards3.Add(new Card(CardSuit.Hearts, CardValue.Ten, true));
            cards4.Add(new Card(CardSuit.Spades, CardValue.Ten, true));
            cards4.Add(new Card(CardSuit.Hearts, CardValue.King, true));
            cards5.Add(new Card(CardSuit.Diamonds, CardValue.Three, true));
            cards5.Add(new Card(CardSuit.Clubs, CardValue.Four, true));
            cardsDealer.Add(new Card(CardSuit.Hearts, CardValue.Three, true));
            cardsDealer.Add(new Card(CardSuit.Diamonds, CardValue.Four, true));

            dealer = new BlackJackDealer(cardsDealer, cardsDealer2);
            HouseCardList_ListBox.ItemsSource = dealer.DealerHand;

            PlayerList.Add(new Player("Player 1", cards1));
            player1Bank.Content = PlayerList[0].PlayerBank;

            if (NumberOfPlayers == 5)
            {
                PlayerList.Add(new Player("Player 2", cards2));
                PlayerList.Add(new Player("Player 3", cards3));
                PlayerList.Add(new Player("Player 4", cards4));
                PlayerList.Add(new Player("Player 5", cards5));
                player3Bank.Content = PlayerList[1].PlayerBank;
                player3Bank.Content = PlayerList[2].PlayerBank;
                player4Bank.Content = PlayerList[3].PlayerBank;
                player5Bank.Content = PlayerList[4].PlayerBank;
            }
            else if (NumberOfPlayers == 4)
            {
                PlayerList.Add(new Player("Player 2", cards2));
                PlayerList.Add(new Player("Player 3", cards3));
                PlayerList.Add(new Player("Player 4", cards4));
                player3Bank.Content = PlayerList[1].PlayerBank;
                player3Bank.Content = PlayerList[2].PlayerBank;
                player4Bank.Content = PlayerList[3].PlayerBank;
            }
            else if (NumberOfPlayers == 3)
            {
                PlayerList.Add(new Player("Player 2", cards2));
                PlayerList.Add(new Player("Player 3", cards3));
                player2Bank.Content = PlayerList[1].PlayerBank;
                player3Bank.Content = PlayerList[2].PlayerBank;
            }
            else if (NumberOfPlayers == 2)
            {
                PlayerList.Add(new Player("Player 2", cards2));
                player2Bank.Content = PlayerList[1].PlayerBank;
            }
            for (int i = 0; i < NumberOfPlayers; i++)
            {
                blackJackDeck.playerDraw(PlayerList[i], 2);
            }
            for (int i = 0; i < NumberOfPlayers; i++)
            {
                PlayerList[i].PlayerHand[0].CardFaceUp = false;
                PlayerList[i].PlayerHand[1].CardFaceUp = true;
            }
            PlayerListBox.ItemsSource   = PlayerList;
            PlayerListBox.SelectedIndex = 0;
            CurrentPlayerLabel.Content  = PlayerList[PlayerListBox.SelectedIndex].Name + "'s Trun";
        }