Ejemplo n.º 1
0
        //public bool IsActive { get; set; }

        public BlackjackPlayer()
        {
            //label_balance = new System.Windows.Forms.Label();
            BlackjackHand temp = new BlackjackHand();
            IsActive = true;
            temp.Status = -1;
            temp.x_nextOffset = 0;
            temp.y_nextOffset = 0;
            hands.Add(temp);
            Balance = BlackjackGame.INITIAL_BALANCE;
        }
Ejemplo n.º 2
0
        //public bool IsActive { get; set; }

        public BlackjackPlayer()
        {
            //label_balance = new System.Windows.Forms.Label();
            BlackjackHand temp = new BlackjackHand();

            IsActive          = true;
            temp.Status       = -1;
            temp.x_nextOffset = 0;
            temp.y_nextOffset = 0;
            hands.Add(temp);
            Balance = BlackjackGame.INITIAL_BALANCE;
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool findNextActivePlayer()
        {
            bool success     = false;
            int  next_player = cur_player + 1;

            for (int i = next_player; i < players.Count; i++)
            {
                if (players[i].IsActive)
                {
                    success     = true;
                    cur_player  = i;
                    currentHand = players[cur_player].hands[cur_hand];
                    break;
                }
            }
            return(success);
        }
Ejemplo n.º 4
0
        }// end function

        public void completesHand()
        {
            // show dealer bottom card
            form_controls.flipDealerCard(hands[0].cards[0].card_front);

            BlackjackHand currentHand = hands[0];

            hands[0].cards[0].IsFaceDown = false;

            // check hand for blackjack or bust
            currentHand.check();

            // dealer takes hit until sum of cards is at least 17
            while (currentHand.Sum < 17)
            {
                //hitSelf();
                dealCard(this, 0);
                currentHand.check();
            }
        } // close function
Ejemplo n.º 5
0
        // complete the round of play with the dealer
        public void finishRound()
        {
            // set dealer as current player
            cur_player  = dealer.id;
            cur_hand    = 0;
            currentHand = dealer.hands[cur_hand];

            dealer.completesHand();

            // update the dealer's hand
            form_controls.update_dealer();

            // show results of player vs dealer
            foreach (BlackjackPlayer player in players)
            {
                if (player.IsActive)
                {
                    showResult(player);
                }
            }

            form_controls.update_finalStatus();
        }
Ejemplo n.º 6
0
 // reset current hand to player 1's first hand
 public void resetCurrentHand()
 {
     cur_player  = 0;
     cur_hand    = 0;
     currentHand = players[cur_player].hands[cur_hand];
 }
Ejemplo n.º 7
0
        // complete the round of play with the dealer
        public void finishRound() {

            // set dealer as current player
            cur_player = dealer.id;
            cur_hand = 0;
            currentHand = dealer.hands[cur_hand];

            dealer.completesHand();

            // update the dealer's hand
            form_controls.update_dealer();

            // show results of player vs dealer
            foreach (BlackjackPlayer player in players){
                if (player.IsActive){
                    showResult(player);
                }
            }

            form_controls.update_finalStatus();
        }
Ejemplo n.º 8
0
 // reset current hand to player 1's first hand
 public void resetCurrentHand()
 {
     cur_player = 0;
     cur_hand = 0;
     currentHand = players[cur_player].hands[cur_hand];
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public bool findNextActivePlayer() {

            bool success = false;
            int next_player = cur_player + 1;

            for (int i = next_player; i < players.Count; i++)
            {
                if(players[i].IsActive){
                    success = true;
                    cur_player = i;
                    currentHand = players[cur_player].hands[cur_hand];
                    break;
                }
            }
            return success;
        }