public void SetFirstCard()
 {
     for (int i = 0; i < 21; i++)
     {
         DealerCards[i] = 0;
     }
     DealerCards[0] = PlayingDecks.GetCard();
 }
        public override void Hit(byte[] hand, byte handFlag = 0)
        {
            uint sum = 0;

            aceFlag = false;
            for (uint counter = 0; counter < 21; counter++)
            {
                sum += hand[counter];
                if (hand[counter] == 1)
                {
                    aceFlag = true;
                }
            }
            if (aceFlag && sum + 10 <= 21)
            {
                sum += 10;
            }
            if (handFlag == 0 && firstHandDoublingFlag)
            {
                PlayersDecisions[DecisionsCounter] = Decisions.Hitting;
                if (sum <= 10)
                {
                    PlayersDecisions[DecisionsCounter] = Decisions.Doubling;
                    if (Money - FirstWager >= 0)
                    {
                        Money     -= FirstWager;
                        FirstWager = FirstWager * 2;
                    }
                }
                DecisionsCounter     += 1;
                firstHandDoublingFlag = true;
            }
            else if (handFlag == 1 && secondHandDoublingFlag)
            {
                PlayersDecisions[DecisionsCounter] = Decisions.Hitting;
                if (sum <= 10)
                {
                    PlayersDecisions[DecisionsCounter] = Decisions.Doubling;
                    if (Money - SecondWager >= 0)
                    {
                        Money      -= SecondWager;
                        SecondWager = SecondWager * 2;
                    }
                }
                DecisionsCounter      += 1;
                secondHandDoublingFlag = true;
            }
            int i = 0;

            while (hand[i] != 0)
            {
                i++;
            }
            hand[i]       = PlayingDecks.GetCard();
            firstDecision = false;
            PlayersTurn(hand, handFlag);
        }
Example #3
0
 public void FillAttrs(byte dealersFirst, uint money, uint wager = 0)
 {
     Money        = money;
     FirstWager   = wager;
     Money       -= FirstWager;
     dealerCard   = dealersFirst;
     FirstHand[0] = PlayingDecks.GetCard();
     FirstHand[1] = PlayingDecks.GetCard();
 }
        private void Hit()
        {
            int i = 0;

            while (DealerCards[i] != 0)
            {
                i++;
            }
            DealerCards[i] = PlayingDecks.GetCard();
        }
Example #5
0
        public override void Hit(byte[] hand, byte handFlag = 0)
        {
            if (handFlag == 0)
            {
                if (firstHandDoublingFlag)
                {
                    PlayersDecisions[DecisionsCounter] = Decisions.Hitting;
                    if (PlayingDecks.CountOfCards >= 2.0)
                    {
                        PlayersDecisions[DecisionsCounter] = Decisions.Doubling;
                        if (Money - FirstWager >= 0)
                        {
                            Money     -= FirstWager;
                            FirstWager = FirstWager * 2;
                        }
                    }
                    DecisionsCounter += 1;
                }
                firstHandDoublingFlag = true;
            }
            else if (handFlag == 1)
            {
                if (secondHandDoublingFlag)
                {
                    PlayersDecisions[DecisionsCounter] = Decisions.Hitting;
                    if (PlayingDecks.CountOfCards >= 2.0)
                    {
                        PlayersDecisions[DecisionsCounter] = Decisions.Doubling;
                        if (Money - SecondWager >= 0)
                        {
                            Money      -= SecondWager;
                            SecondWager = SecondWager * 2;
                        }
                    }
                    DecisionsCounter += 1;
                }
                secondHandDoublingFlag = true;
            }
            int i = 0;

            while (hand[i] != 0)
            {
                i++;
            }
            hand[i]       = PlayingDecks.GetCard();
            firstDecision = false;
            PlayersTurn(hand, handFlag);
        }
Example #6
0
        public virtual void Hit(byte[] hand, byte handFlag = 0)
        {
            int i = 0;

            while (hand[i] != 0)
            {
                i++;
            }
            hand[i]       = PlayingDecks.GetCard();
            firstDecision = false;
            if ((handFlag == 0 && firstHandDoublingFlag) || (handFlag == 1 && secondHandDoublingFlag))
            {
                PlayersDecisions[DecisionsCounter] = Decisions.Hitting;
                DecisionsCounter += 1;
            }
            PlayersTurn(hand, handFlag);
        }