예제 #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;
        }
예제 #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;
        }
예제 #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);
        }
예제 #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
예제 #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();
        }
예제 #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];
 }
예제 #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();
        }
예제 #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];
 }
예제 #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;
        }