예제 #1
0
 private void BlackjackForm_Load(object sender, EventArgs e)
 {
     //init vectors
     Deck    = new FrenchDeck(NUMBER_OF_DECK);
     ImgDeck = new Image[Enum.GetValues(typeof(Seed)).Length, Enum.GetValues(typeof(Value)).Length];
     Deck.Initialize();
 }
예제 #2
0
        public void UpgradePoints(FrenchDeck deck, string gamer)
        {
            switch (gamer)
            {
            case "dealer":
                if (deck.Deck[deck.ExtractCard].Value == Value.Ace)
                {
                    if (IsDealerAceChanged)
                    {
                        DealerPoints += 1;
                    }
                    else
                    {
                        DealerPoints += 11;
                        DealerAcesNumber++;
                    }
                }
                else if (deck.Deck[deck.ExtractCard].Value == Value.Jack || deck.Deck[deck.ExtractCard].Value == Value.Queen || deck.Deck[deck.ExtractCard].Value == Value.King)
                {
                    DealerPoints += 10;
                }
                else
                {
                    DealerPoints += ((int)deck.Deck[deck.ExtractCard].Value + 1);
                }
                break;

            case "player":
                if (deck.Deck[deck.ExtractCard].Value == Value.Ace)
                {
                    if (IsPlayerAceChanged)
                    {
                        PlayerPoints += 1;
                    }
                    else
                    {
                        PlayerPoints += 11;
                        PlayerAcesNumber++;
                    }
                }
                else if (deck.Deck[deck.ExtractCard].Value == Value.Jack || deck.Deck[deck.ExtractCard].Value == Value.Queen || deck.Deck[deck.ExtractCard].Value == Value.King)
                {
                    PlayerPoints += 10;
                }
                else
                {
                    PlayerPoints += ((int)deck.Deck[deck.ExtractCard].Value + 1);
                }
                break;
            }
        }