Beispiel #1
0
        private void dealerDraw(List <int> skipList, List <Card> card_list, List <Card> dealersCards, List <Card> playersCards, Player_Statistics ps)
        {
            for (int i = 0; i < card_list.Count; i++)
            {
                if (!(isSkipIndex(i, skipList)))
                {
                    //  Make Clones so the lists can be passed "ByValue"
                    List <int>  skipList_clone     = new List <int>(skipList);
                    List <Card> dealersCards_clone = new List <Card>(dealersCards);

                    dealersCards_clone.Add(card_list.ElementAt(i));
                    if (BlackJack.getHandValue(dealersCards_clone) < 17)
                    {
                        skipList_clone.Add(i);

                        dealerDraw(skipList_clone, card_list, dealersCards_clone, playersCards, ps);
                    }
                    else
                    {
                        //  Dealer will stand on S17
                        BlackjackResult bjr = BlackJack.getGameResult(dealersCards_clone, playersCards);
                        ps.addStat(playersCards, dealersCards_clone.ElementAt(0), bjr); //  TODO: Check this if 0 is dealers first card
                    }
                }
            }
        }
 public void getResults(List <Player> players, Player_Statistics ps)
 {
     foreach (Player p in players)
     {
         //  We will test hard hands and soft hand separatly and split hands seperatly
         if (!p.hasAceInInitalHand() & !p.hasDoublesInInitialHand() & !this.hasBlackJack())
         {
             BlackjackResult result = BlackJack.getGameResult(this.Cards, p.getHand(0));
             ps.addStat(p.getHand(0), this.Cards[0], result);
         }
     }
 }