Ejemplo n.º 1
0
        //Get the odd card out of a two pair
        private int OddCardOut(Card[] hand)
        {
            int retCard = 0;

            //Get both pairs
            int firstPair  = 0;
            int secondPair = 0;

            for (int i = 2; i < 15; i++)
            {
                if (Evaluate.ValueCount(i, hand) == 2)
                {
                    if (firstPair == 0)
                    {
                        firstPair = i;
                    }
                    else
                    {
                        secondPair = i;
                    }
                }
            }

            //Find the 5th card
            for (int i = 0; i < hand.Length; i++)
            {
                if (hand[i].Value != firstPair && hand[i].Value != secondPair)
                {
                    retCard = i;
                }
            }

            return(retCard);
        }
Ejemplo n.º 2
0
        public override int Discard(ref Card[] hand, int rating)
        {
            int discard = 0;

            //track which indexies need to be discarded
            bool[] toDiscard = { false, false, false, false, false };
            //loop through hand
            for (int i = 0; i < 5; i++)
            {
                //check if card is only one of its value in hand
                if (Evaluate.ValueCount(hand[i].Value, hand) == 1)
                {
                    toDiscard[i] = true;
                    discard++;
                }
            }

            //discarding must be our last action, Evaluate methods will fail if items are null
            if (discard > 0)                //if we have things to discard
            {
                for (int j = 0; j < 5; j++) //loop through and discard them
                {
                    if (toDiscard[j])
                    {
                        hand[j] = null;
                    }
                }
            }

            return(discard);
        }
Ejemplo n.º 3
0
        public List <int> CheckPair()
        {
            List <int> valCount = new List <int>();

            for (int r = 2; r < 15; r++)
            {
                int tempCount = Evaluate.ValueCount(r, Hand);
                if (tempCount > 1)
                {
                    valCount.Add(r);
                }
            }
            return(valCount);
        }
Ejemplo n.º 4
0
        //Get all cards that aren't part of a matching group
        private List <int> UnmatchingCards(Card[] hand, int numMatchingCards)
        {
            List <int> retCardIndices = new List <int>();

            for (int i = 2; i < 15; i++)
            {
                //Go until we find the designated group
                if (Evaluate.ValueCount(i, hand) == numMatchingCards)
                {
                    for (int j = 0; j < hand.Length; j++)
                    {
                        if (hand[j].Value != i)
                        {
                            retCardIndices.Add(j);
                        }
                    }
                }
            }

            return(retCardIndices);
        }
Ejemplo n.º 5
0
        public override PlayerAction Draw(Card[] hand)
        {
            int handValue = Evaluate.RateAHand(hand, out highCard);                 // Gets the value of the hand we have

            Evaluate.SortHand(hand);                                                // Sorts hand

            if (handValue == 10 || handValue == 9 || handValue == 7 || handValue == 6 || handValue == 5)
            {
                Speak("I swap nothing, mortal");
                return(new PlayerAction(Name, "Draw", "stand pat", 0));
            }
            if (handValue == 8)
            {
                Speak("I swap one card");

                //find card that isn't part of 4 of a kind and remove it
                for (int i = 2; i < 15; i++)
                {
                    if (Evaluate.ValueCount(i, hand) == 4)
                    {
                        for (int j = 0; j < 5; j++)
                        {
                            if (hand[j].Value != i)
                            {
                                hand[j] = null;
                            }
                        }
                    }
                }

                return(new PlayerAction(Name, "Draw", "draw", 1));
            }
            if (handValue == 4)
            {
                Speak("I swap two cards");
                List <int> cardsToRemove = new List <int>();

                //find cards that aren't part of three of a kind and remove them
                for (int i = 2; i < 15; i++)
                {
                    if (Evaluate.ValueCount(i, hand) == 3)
                    {
                        for (int j = 0; j < 5; j++)
                        {
                            if (hand[j].Value != i)
                            {
                                cardsToRemove.Add(j);
                                //hand[j] = null;
                            }
                        }
                    }
                }

                //remove the ones we need to
                hand[cardsToRemove[0]] = null;
                hand[cardsToRemove[1]] = null;

                //request 2 cards
                return(new PlayerAction(Name, "Draw", "draw", 2));
            }
            if (handValue == 3)
            {
                Speak("I swap one card");

                //find card that isn't part of either pair and remove it
                // Get the first pair
                int firstPair = 0;
                for (int i = 2; i < 15; i++)
                {
                    if (Evaluate.ValueCount(i, hand) == 2)
                    {
                        firstPair = i;
                    }
                }

                // now get the second pair
                int secondPair = 0;
                for (int i = 2; i < 15; i++)
                {
                    if (i == firstPair)
                    {
                        continue;                 // skip this value
                    }
                    if (Evaluate.ValueCount(i, hand) == 2)
                    {
                        secondPair = i;
                    }
                }
                for (int i = 0; i < 5; i++)
                {
                    if (hand[i].Value != firstPair && hand[i].Value != secondPair)
                    {
                        hand[i] = null;
                    }
                }

                return(new PlayerAction(Name, "Draw", "draw", 1));
            }
            if (handValue == 2)
            {
                //find the value that is the pair
                int pair = 0;
                for (int i = 2; i < 15; i++)
                {
                    if (Evaluate.ValueCount(i, hand) == 2)
                    {
                        pair = i;
                    }
                }

                //find the cards that are not the pair and replace them
                for (int i = 0; i < 5; i++)
                {
                    if (hand[i].Value != pair)
                    {
                        hand[i] = null;
                    }
                }

                Speak("I swap three cards");
                return(new PlayerAction(Name, "Draw", "draw", 3));
            }
            if (handValue == 1)
            {
                Speak("I swap four cards");

                //Checks for 3 or more of same suit
                string flushSuit = "";
                int    suitCount = 0;
                for (int i = 0; i < hand.Length; i++)
                {
                    for (int j = 0; j < hand.Length; j++)
                    {
                        if (hand[i].Suit == hand[j].Suit && i != j)
                        {
                            suitCount++;
                        }
                    }
                    if (suitCount >= 3)
                    {
                        flushSuit = hand[i].Suit;
                        break;
                    }
                }
                if (flushSuit != "")
                {
                    int count = 0;
                    for (int i = 0; i < 5; i++)
                    {
                        if (hand[i].Suit != flushSuit)
                        {
                            hand[i] = null;
                            count++;
                        }
                    }
                    Console.WriteLine("requesting " + (5 - count) + " new cards");
                    return(new PlayerAction(Name, "Draw", "draw", count));
                }

                // checks for a hand that is almost a straight
                // ex: 4, 5, 7, 8, Ace| 4, 5, 6, 7, 10|
                // so Two in a row, then 1 missing, then Two more in a row
                // or Three in a row, 1 missing, then 1
                // or Four in a row
                if (hand[0].Value == hand[1].Value - 1 &&
                    hand[0].Value == hand[2].Value - 2 &&
                    hand[0].Value == hand[3].Value - 3 &&
                    hand[0].Value != hand[4].Value - 4)
                {
                    hand[4] = null;
                    return(new PlayerAction(Name, "Draw", "draw", 1));
                }
                else if (hand[0].Value == hand[1].Value - 1 &&
                         hand[0].Value == hand[2].Value - 2 &&
                         hand[0].Value != hand[3].Value - 3 &&
                         hand[0].Value == hand[4].Value - 4)
                {
                    hand[3] = null;
                    return(new PlayerAction(Name, "Draw", "draw", 1));
                }
                else if (hand[0].Value == hand[1].Value - 1 &&
                         hand[0].Value != hand[2].Value - 2 &&
                         hand[0].Value == hand[3].Value - 3 &&
                         hand[0].Value == hand[4].Value - 4)
                {
                    hand[2] = null;
                    return(new PlayerAction(Name, "Draw", "draw", 1));
                }
                else if (hand[0].Value != hand[1].Value - 1 &&
                         hand[0].Value == hand[2].Value - 2 &&
                         hand[0].Value == hand[3].Value - 3 &&
                         hand[0].Value == hand[4].Value - 4)
                {
                    hand[1] = null;
                    return(new PlayerAction(Name, "Draw", "draw", 1));
                }
                else if (hand[1].Value != hand[2].Value - 1 &&
                         hand[1].Value == hand[3].Value - 2 &&
                         hand[1].Value == hand[4].Value - 3 &&
                         hand[1].Value == hand[0].Value + 1)
                {
                    hand[0] = null;
                    return(new PlayerAction(Name, "Draw", "draw", 1));
                }


                else
                {
                    return(new PlayerAction(Name, "Draw", "draw", 4));
                }
            }
            else
            {
                return(new PlayerAction(Name, "Draw", "stand pat", 0));
            }
        }
Ejemplo n.º 6
0
        // plays 1 round of poker
        private string Round()
        {
            string text = "";                                        // result text
            List <PlayerAction> actions = new List <PlayerAction>(); // list of actions

            // reset the pot
            if (pot % 2 == 0)  // even numbered pot
            {
                pot = anteAmt; // pot with antes only
            }
            else // odd pot
            {
                // in this case, the pot was not an even number
                // so there was 1 credit left over for the starting pot
                // In theory this should never happen.
                pot = anteAmt + 1;
            }
            // call players in order
            Player[] playerOrder = new Player[2];

            // note that playerOrder[1] always contains the dealer
            if (p0.Dealer == true)   // player 0 deals?
            {
                playerOrder[0] = p1; // p1 goes first
                playerOrder[1] = p0;
            }
            else
            {
                playerOrder[0] = p0; // p0 goes first
                playerOrder[1] = p1;
            }
            // setup deck for a new round
            deck.NewRound();

            // dealer deals out 5 cards to each player
            playerOrder[0].Hand = deck.Deal(5);
            playerOrder[1].Hand = deck.Deal(5);

            // round 1 of betting - loop until both players check,
            // one folds, or one calls
            ResultWriter("Betting round 1:");

            Boolean done = false; // flags when finished

            do
            {
                PlayerAction pa0   = playerOrder[0].BettingRound1(actions, playerOrder[0].Hand);
                bool         valid = CheckAction("Bet1", actions, pa0);
                if (valid == false)
                {
                    ResultWriter(playerOrder[0].Name + " played a bad action of " + pa0.ActionName + " and forfeits the hand");
                    pa0 = new PlayerAction(pa0.Name, pa0.ActionPhase, "fold", 0);
                }
                actions.Add(pa0);
                ResultWriter(pa0.ToString());
                ResultWriter(" ");

                // handle the case of the first player calling - the
                // second player must also call - do this automatically
                // and break out of the loop
                if (pa0.ActionName == "call")
                {
                    // add the second player's action automatically
                    PlayerAction pa1 = new PlayerAction(playerOrder[1].Name, "Bet1", "call", 0);
                    actions.Add(pa1);
                    break; // done betting
                }

                if (pa0.ActionName != "fold") // first player did not fold
                {
                    PlayerAction pa1 = playerOrder[1].BettingRound1(actions, playerOrder[1].Hand);
                    valid = CheckAction("Bet1", actions, pa1);
                    if (valid == false)
                    {
                        ResultWriter(playerOrder[1].Name + " played a bad action of " + pa1.ActionName + " and forfeits the hand");
                        pa1 = new PlayerAction(pa1.Name, pa1.ActionPhase, "fold", 0);
                    }
                    actions.Add(pa1);
                    ResultWriter(pa1.ToString());
                    ResultWriter(" ");
                }
                done = EvaluateActions(actions, "Bet1");
            } while (done == false);

            // update the pot based on the bets
            int lastBet = 0;

            for (int i = 0; i < actions.Count; i++)
            {
                if (actions[i].ActionPhase == "Bet1")
                {
                    switch (actions[i].ActionName)
                    {
                    case "bet":
                        lastBet = actions[i].Amount;
                        pot    += lastBet;                          // adjust the pot
                        // deduct from player
                        if (actions[i].Name == playerOrder[0].Name) // player0 bet?
                        {
                            playerOrder[0].ChangeMoney(-lastBet);
                        }
                        else     // must be player1
                        {
                            playerOrder[1].ChangeMoney(-lastBet);
                        }
                        break;

                    case "raise":
                        int total = lastBet;                        // amt from previous player
                        pot    += lastBet;                          // player raising must match last bet
                        lastBet = actions[i].Amount;
                        total  += lastBet;                          // amt being raised
                        pot    += lastBet;                          // plus the amount raised
                        // deduct from player
                        if (actions[i].Name == playerOrder[0].Name) // player0 bet?
                        {
                            playerOrder[0].ChangeMoney(-total);
                        }
                        else     // must be player1
                        {
                            playerOrder[1].ChangeMoney(-total);
                        }
                        break;

                    case "call":
                        // skip if this is a call after another call
                        if (i - 1 >= 0)
                        {
                            if (actions[i - 1].ActionName == "call")
                            {
                                break;
                            }
                        }
                        pot += lastBet;                             // match the last bet
                        // deduct from player
                        if (actions[i].Name == playerOrder[0].Name) // player0 bet?
                        {
                            playerOrder[0].ChangeMoney(-lastBet);
                        }
                        else     // must be player1
                        {
                            playerOrder[1].ChangeMoney(-lastBet);
                        }
                        break;
                    }
                }
            }

            ResultWriter("After Bet1, pot is " + pot);
            ResultWriter(" ");

            // see if someone folded
            if (actions[actions.Count - 1].ActionName == "fold" &&
                actions[actions.Count - 1].Name == playerOrder[1].Name)
            {
                // if the player in playerOrder[1] folded, other
                // player gets the pot
                playerOrder[0].ChangeMoney(pot);
                string result = actions[actions.Count - 1].Name + " folded. Other player gets the pot of " + pot;
                pot = 0;        // clear the pot
                return(result); // skip rest of loop
            }
            else if (actions[actions.Count - 1].ActionName == "fold" &&
                     actions[actions.Count - 1].Name == playerOrder[0].Name)
            {
                // if the player in playerOrder[1] folded, other
                // player gets the pot
                playerOrder[1].ChangeMoney(pot);
                string result = actions[actions.Count - 1].Name + " folded. Other player gets the pot of " + pot;
                pot = 0;        // clear the pot
                return(result); // skip rest of loop
            }

            // draw
            for (int i = 0; i < playerOrder.Length; i++)
            {
                PlayerAction pa = playerOrder[i].Draw(playerOrder[i].Hand);
                actions.Add(pa);
                if (pa.Amount > 0)
                {
                    Card[] newCards = deck.Deal(pa.Amount); // get cards
                    playerOrder[i].AddCards(playerOrder[i].Hand, newCards);
                }
                ResultWriter("Name: " + playerOrder[i].Name);
                string handList = Evaluate.ListHand(playerOrder[i].Hand);
                ResultWriter(handList);
                ResultWriter(" ");
            }

            // round 2 of betting- loop until both players check,
            // one folds, or one calls
            ResultWriter("Betting round 2:");
            done = false; // flags when finished
            do
            {
                PlayerAction pa0   = playerOrder[0].BettingRound2(actions, playerOrder[0].Hand);
                bool         valid = CheckAction("Bet2", actions, pa0);
                if (valid == false)
                {
                    ResultWriter(playerOrder[0].Name + " played a bad action of " + pa0.ActionName + " and forfeits the hand");
                    pa0 = new PlayerAction(pa0.Name, pa0.ActionPhase, "fold", 0);
                }
                actions.Add(pa0);
                ResultWriter(pa0.ToString());
                ResultWriter(" ");

                // handle the case of the first player calling - the
                // second player must also call - do this automatically
                // and break out of the loop
                if (pa0.ActionName == "call")
                {
                    // add the second player's action automatically
                    PlayerAction pa1 = new PlayerAction(playerOrder[1].Name, "Bet2", "call", 0);
                    actions.Add(pa1);
                    break; // done betting
                }

                if (pa0.ActionName != "fold") // first player did not fold
                {
                    PlayerAction pa1 = playerOrder[1].BettingRound2(actions, playerOrder[1].Hand);
                    valid = CheckAction("Bet2", actions, pa1);
                    if (valid == false)
                    {
                        ResultWriter(playerOrder[1].Name + " played a bad action of " + pa1.ActionName + " and forfeits the hand");
                        pa1 = new PlayerAction(pa1.Name, pa1.ActionPhase, "fold", 0);
                    }
                    actions.Add(pa1);
                    ResultWriter(pa1.ToString());
                    ResultWriter(" ");
                }
                done = EvaluateActions(actions, "Bet2");
            } while (done == false);

            // update the pot based on the bets
            lastBet = 0;
            for (int i = 0; i < actions.Count; i++)
            {
                if (actions[i].ActionPhase == "Bet2")
                {
                    switch (actions[i].ActionName)
                    {
                    case "bet":
                        lastBet = actions[i].Amount;
                        pot    += lastBet;                          // adjust the pot
                        // deduct from player
                        if (actions[i].Name == playerOrder[0].Name) // player0 bet?
                        {
                            playerOrder[0].ChangeMoney(-lastBet);
                        }
                        else     // must be player1
                        {
                            playerOrder[1].ChangeMoney(-lastBet);
                        }
                        break;

                    case "raise":
                        int total = lastBet;                        // amt from previous player
                        pot    += lastBet;                          // player raising must match last bet
                        lastBet = actions[i].Amount;
                        total  += lastBet;                          // amt being raised
                        pot    += lastBet;                          // plus the amount raised
                        // deduct from player
                        if (actions[i].Name == playerOrder[0].Name) // player0 bet?
                        {
                            playerOrder[0].ChangeMoney(-total);
                        }
                        else     // must be player1
                        {
                            playerOrder[1].ChangeMoney(-total);
                        }
                        break;

                    case "call":
                        // skip if this is a call after another call
                        if (i - 1 >= 0)
                        {
                            if (actions[i - 1].ActionName == "call")
                            {
                                break;
                            }
                        }
                        pot += lastBet;                             // match the last bet
                        // deduct from player
                        if (actions[i].Name == playerOrder[0].Name) // player0 bet?
                        {
                            playerOrder[0].ChangeMoney(-lastBet);
                        }
                        else     // must be player1
                        {
                            playerOrder[1].ChangeMoney(-lastBet);
                        }
                        break;
                    }
                }
            }

            ResultWriter("After Bet2, pot is " + pot);
            ResultWriter(" ");

            // see if someone folded
            if (actions[actions.Count - 1].ActionName == "fold" &&
                actions[actions.Count - 1].Name == playerOrder[1].Name)
            {
                // if the player in playerOrder[1] folded, other
                // player gets the pot
                playerOrder[0].ChangeMoney(pot);
                string result = actions[actions.Count - 1].Name + " folded. Other player gets the pot of " + pot;
                pot = 0;        // clear the pot
                return(result); // skip rest of loop
            }
            else if (actions[actions.Count - 1].ActionName == "fold" &&
                     actions[actions.Count - 1].Name == playerOrder[0].Name)
            {
                // if the player in playerOrder[1] folded, other
                // player gets the pot
                playerOrder[1].ChangeMoney(pot);
                string result = actions[actions.Count - 1].Name + " folded. Other player gets the pot of " + pot;
                pot = 0;        // clear the pot
                return(result); // skip rest of loop
            }

            // round resolution
            // see if there is a clear winner based on hand strength
            Card highCard = null;
            int  p0Rank   = Evaluate.RateAHand(playerOrder[0].Hand, out highCard);
            int  p1Rank   = Evaluate.RateAHand(playerOrder[1].Hand, out highCard);

            if (p0Rank > p1Rank)
            {
                text = playerOrder[0].Name + " has a better hand and wins " + pot;
                playerOrder[0].ChangeMoney(pot);
                pot = 0;
            }
            else if (p1Rank > p0Rank)
            {
                text = playerOrder[1].Name + " has a better hand and wins " + pot;
                playerOrder[1].ChangeMoney(pot);
                pot = 0;
            }
            else // same rank - needs further examination
            {
                // sort both hands
                Evaluate.SortHand(playerOrder[0].Hand);
                Card[] hand0 = playerOrder[0].Hand;
                Evaluate.SortHand(playerOrder[1].Hand);
                Card[] hand1 = playerOrder[1].Hand;

                switch (p0Rank)
                {
                case 1:     // high card
                    for (int i = 4; i >= 0; i--)
                    {
                        if (hand0[i].Value != hand1[i].Value)
                        {
                            if (hand0[i].Value > hand1[i].Value)
                            {
                                text = playerOrder[0].Name + " has a better hand and wins " + pot;
                                playerOrder[0].ChangeMoney(pot);
                                pot = 0;
                            }
                            else if (hand1[i].Value > hand0[i].Value)
                            {
                                text = playerOrder[1].Name + " has a better hand and wins " + pot;
                                playerOrder[1].ChangeMoney(pot);
                                pot = 0;
                            }
                        }
                    }

                    // could be a tie
                    if (pot != 0)
                    {
                        playerOrder[0].ChangeMoney(pot / 2);
                        playerOrder[1].ChangeMoney(pot / 2);
                        text = "Tie, each player gets " + pot / 2;
                        if (pot % 2 != 0)
                        {
                            pot = 1;
                        }
                        else
                        {
                            pot = 0;
                        }
                    }
                    break;

                case 2:     // one pair
                    // get the pair for playerOrder[0]
                    int p0Pair = 0;
                    for (int j = 14; j >= 2; j--)
                    {
                        int count = Evaluate.ValueCount(j, hand0);
                        if (count == 2)    // found the pair
                        {
                            p0Pair = j;
                            break;
                        }
                    }

                    // do  the same for the other hand
                    int p1Pair = 0;
                    for (int k = 14; k >= 2; k--)
                    {
                        int count = Evaluate.ValueCount(k, hand1);
                        if (count == 2)     // found the pair
                        {
                            p1Pair = k;
                            break;
                        }
                    }

                    // which is higher
                    if (p0Pair > p1Pair)    // playerOrder[0] wins
                    {
                        text = playerOrder[0].Name + " has a better hand and wins " + pot;
                        playerOrder[0].ChangeMoney(pot);
                    }
                    else if (p1Pair > p0Pair)
                    {
                        text = playerOrder[1].Name + " has a better hand and wins " + pot;
                        playerOrder[1].ChangeMoney(pot);
                    }
                    else
                    {       // need to see what the high
                            // card is aside from the pair
                            // get the cards that are not part of a pair from hand0
                        Card[] h0NotPair = new Card[3];
                        int    pos       = 0;
                        for (int i = 0; i < hand0.Length; i++)
                        {
                            if (hand0[i].Value != p0Pair)
                            {
                                h0NotPair[pos] = hand0[i];
                                pos++;
                            }
                        }

                        // do the same for the next hand
                        Card[] h1NotPair = new Card[3];
                        pos = 0;
                        for (int i = 0; i < hand1.Length; i++)
                        {
                            if (hand1[i].Value != p1Pair)
                            {
                                h1NotPair[pos] = hand1[i];
                                pos++;
                            }
                        }

                        // see if high card breakes the tie
                        for (int i = 2; i >= 0; i--)
                        {
                            if (h0NotPair[i].Value != h1NotPair[i].Value)
                            {
                                if (h0NotPair[i].Value > h1NotPair[i].Value)
                                {
                                    text = playerOrder[0].Name + " has a better hand and wins " + pot;
                                    playerOrder[0].ChangeMoney(pot);
                                    pot = 0;
                                }
                                else if (h1NotPair[i].Value > h0NotPair[i].Value)
                                {
                                    text = playerOrder[1].Name + " has a better hand and wins " + pot;
                                    playerOrder[1].ChangeMoney(pot);
                                    pot = 0;
                                }
                            }
                        }

                        // could be a tie
                        if (pot != 0)
                        {
                            playerOrder[0].ChangeMoney(pot / 2);
                            playerOrder[1].ChangeMoney(pot / 2);
                            text = "Tie, each player gets " + pot / 2;
                            if (pot % 2 != 0)
                            {
                                pot = 1;
                            }
                            else
                            {
                                pot = 0;
                            }
                        }
                    }
                    break;

                case 3:     // two pair
                    // get the two pair
                    int[] h0Pair = new int[2];
                    int[] h1Pair = new int[2];

                    // get hand0 pairs
                    int pCount = 0;
                    for (int i = 14; i >= 2; i--)
                    {
                        int count = Evaluate.ValueCount(i, hand0);
                        if (count == 2)     // found the pair
                        {
                            h0Pair[pCount] = i;
                            pCount++;
                        }
                    }

                    // get the hand1 pairs
                    pCount = 0;
                    for (int i = 14; i >= 2; i--)
                    {
                        int count = Evaluate.ValueCount(i, hand1);
                        if (count == 2)     // found the pair
                        {
                            h1Pair[pCount] = i;
                            pCount++;
                        }
                    }
                    // compare the pairs
                    if (h0Pair[0] > h1Pair[0])    // playerOrder[0] wins
                    {
                        text = playerOrder[0].Name + " has a better hand and wins " + pot;
                        playerOrder[0].ChangeMoney(pot);
                    }
                    else if (h1Pair[0] > h0Pair[0])     // playerOrder[1] wins
                    {
                        text = playerOrder[1].Name + " has a better hand and wins " + pot;
                        playerOrder[1].ChangeMoney(pot);
                        pot = 0;
                    }
                    else     // tie on the highest pair
                    {
                        // compare the second pair
                        if (h0Pair[1] > h1Pair[1])     // playerOrder[0] wins
                        {
                            text = playerOrder[0].Name + " has a better hand and wins " + pot;
                            playerOrder[0].ChangeMoney(pot);
                            pot = 0;
                        }
                        else if (h1Pair[0] > h0Pair[0])     // playerOrder[1] wins
                        {
                            text = playerOrder[1].Name + " has a better hand and wins " + pot;
                            playerOrder[1].ChangeMoney(pot);
                            pot = 0;
                        }
                        else     // tie on the highest pair
                        {
                            playerOrder[0].ChangeMoney(pot / 2);
                            playerOrder[1].ChangeMoney(pot / 2);
                            text = "Tie, each player gets " + pot / 2;
                            // tie overall
                            if (pot % 2 != 0)
                            {
                                pot = 1;
                            }
                            else
                            {
                                pot = 0;
                            }
                        }
                    }
                    break;

                case 4:     // three of a kind
                    // get the pair for playerOrder[0]
                    int p0Three = 0;
                    for (int j = 14; j >= 2; j--)
                    {
                        int count = Evaluate.ValueCount(j, hand0);
                        if (count == 3)     // found the pair
                        {
                            p0Three = j;
                            break;
                        }
                    }

                    // do  the same for the other hand
                    int p1Three = 0;
                    for (int k = 14; k >= 2; k--)
                    {
                        int count = Evaluate.ValueCount(k, hand1);
                        if (count == 3)     // found the three cards
                        {
                            p1Three = k;
                            break;
                        }
                    }

                    // which is higher - no possibility of a tie
                    if (p0Three > p1Three)     // playerOrder[0] wins
                    {
                        text = playerOrder[0].Name + " has a better hand and wins " + pot;
                        playerOrder[0].ChangeMoney(pot);
                    }
                    else
                    {
                        text = playerOrder[1].Name + " has a better hand and wins " + pot;
                        playerOrder[1].ChangeMoney(pot);
                    }
                    pot = 0;
                    break;

                case 5:     // straight
                    // compare the top card - if one is higher than the other, that
                    // player is the winner. Otherwise, there is a tie
                    if (hand0[0].Value > hand1[0].Value)
                    {
                        text = playerOrder[0].Name + " has a better hand and wins " + pot;
                        playerOrder[0].ChangeMoney(pot);
                        pot = 0;
                    }
                    else if (hand1[0].Value > hand0[0].Value)
                    {
                        text = playerOrder[1].Name + " has a better hand and wins " + pot;
                        playerOrder[1].ChangeMoney(pot);
                        pot = 0;
                    }
                    else     // tie
                    {
                        playerOrder[0].ChangeMoney(pot / 2);
                        playerOrder[1].ChangeMoney(pot / 2);
                        text = "Tie, each player gets " + pot / 2;
                        if (pot % 2 != 0)
                        {
                            pot = 1;
                        }
                        else
                        {
                            pot = 0;
                        }
                    }
                    break;

                case 6:     // flush
                    // locate the high cards and keep testing until you
                    // either have a tie or a winner
                    // tie flag
                    Boolean tie = true;
                    for (int i = 4; i >= 0; i--)
                    {
                        if (hand0[i].Value != hand1[i].Value)
                        {
                            // determine the winner
                            if (hand0[i].Value > hand1[i].Value)
                            {
                                text = playerOrder[0].Name + " has a better hand and wins " + pot;
                                playerOrder[0].ChangeMoney(pot);
                                pot = 0;
                            }
                            else
                            {
                                text = playerOrder[1].Name + " has a better hand and wins " + pot;
                                playerOrder[1].ChangeMoney(pot);
                                pot = 0;
                            }
                            // not a tie
                            tie = false;
                            break;     // exit loop
                        }
                    }
                    // handle a tie
                    if (tie == true)
                    {
                        playerOrder[0].ChangeMoney(pot / 2);
                        playerOrder[1].ChangeMoney(pot / 2);
                        text = "Tie, each player gets " + pot / 2;
                        if (pot % 2 != 0)
                        {
                            pot = 1;
                        }
                        else
                        {
                            pot = 0;
                        }
                    }
                    break;

                case 7:     // full house
                    // get the two pair
                    int h0FH = 0;
                    int h1FH = 0;

                    // get hand0 triple
                    for (int i = 14; i >= 2; i--)
                    {
                        int count = Evaluate.ValueCount(i, hand0);

                        if (count == 3)     // found the triple
                        {
                            h0FH = i;
                        }
                    }

                    // get the hand1 triple

                    for (int i = 14; i >= 2; i--)
                    {
                        int count = Evaluate.ValueCount(i, hand1);

                        if (count == 3)     // found the triple
                        {
                            h1FH = i;
                        }
                    }
                    // compare the triples
                    if (h0FH > h1FH)     // playerOrder[0] wins
                    {
                        text = playerOrder[0].Name + " has a better hand and wins " + pot;
                        playerOrder[0].ChangeMoney(pot);
                    }
                    else     // playerOrder[1] wins
                    {
                        text = playerOrder[1].Name + " has a better hand and wins " + pot;
                        playerOrder[1].ChangeMoney(pot);
                    }
                    pot = 0;
                    break;

                case 8:     // four of a kind
                    // get the pair for playerOrder[0]
                    int p0Four = 0;
                    for (int j = 14; j >= 2; j--)
                    {
                        int count = Evaluate.ValueCount(j, hand0);
                        if (count == 4)     // found the  4 cards
                        {
                            p0Four = j;
                            break;
                        }
                    }

                    // do  the same for the other hand
                    int p1Four = 0;
                    for (int k = 14; k >= 2; k--)
                    {
                        int count = Evaluate.ValueCount(k, hand1);
                        if (count == 4)     // found the pair
                        {
                            p1Four = k;
                            break;
                        }
                    }

                    // which is higher - no possible tie
                    if (p0Four > p1Four)     // playerOrder[0] wins
                    {
                        text = playerOrder[0].Name + " has a better hand and wins " + pot;
                        playerOrder[0].ChangeMoney(pot);
                    }
                    else
                    {
                        text = playerOrder[1].Name + " has a better hand and wins " + pot;
                        playerOrder[1].ChangeMoney(pot);
                    }
                    pot = 0;
                    break;

                case 9:     // straight flush
                    // compare the top card - if one is higher than the other, that
                    // player is the winner. Otherwise, there is a tie
                    if (hand0[4].Value > hand1[4].Value)
                    {
                        text = playerOrder[0].Name + " has a better hand and wins " + pot;
                        playerOrder[0].ChangeMoney(pot);
                        pot = 0;
                    }
                    else if (hand1[4].Value > hand0[4].Value)
                    {
                        text = playerOrder[1].Name + " has a better hand and wins " + pot;
                        playerOrder[1].ChangeMoney(pot);
                        pot = 0;
                    }
                    else     // tie
                    {
                        playerOrder[0].ChangeMoney(pot / 2);
                        playerOrder[1].ChangeMoney(pot / 2);
                        text = "Tie, each player gets " + pot / 2;
                        if (pot % 2 == 0)
                        {
                            pot = 1;
                        }
                        else
                        {
                            pot = 0;
                        }
                    }
                    break;

                case 10:     // royal flush
                    // automatic tie - split the pot
                    playerOrder[0].ChangeMoney(pot / 2);
                    playerOrder[1].ChangeMoney(pot / 2);
                    text = "Tie, each player gets " + pot / 2;
                    if (pot % 2 != 0)
                    {
                        pot = 1;
                    }
                    else
                    {
                        pot = 0;
                    }
                    break;
                }
            }

            // return results
            return(text);
        }
Ejemplo n.º 7
0
        public override PlayerAction Draw(Card[] hand)
        {
            /// Keeping it super rudimentary
            /// Fuzzy logic might be better here
            /// But since every rank corresponds with a different set of cards (IE: 1 = high card,  2 = Two pair, 10 is always = Royal Flush), 10 if statements are easier to manage imo
            ///

            PlayerAction pa = new PlayerAction(Name, "Draw", "stand pat", 0);


            // Print out the hand so we can see it
            //ListTheHand(hand);
            Console.WriteLine("\n");

            // The first thing we should do is to evaluate our hand
            Card highCard = null;
            int  rank     = Evaluate.RateAHand(hand, out highCard);


            // If you have nothing
            switch (rank)
            {
            case 1:     // You have nothing;
                #region Section 1 (High Card)
                Console.WriteLine("\n AI didn't like their hand.");
                // If your high is 10 or greater, then get rid of everything but the 10+
                // Otherwise, dump everything and redraw
                if (highCard.Value >= 10)
                {
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i] == highCard)
                        {
                            continue;
                        }

                        hand[i] = null;
                    }
                    pa = new PlayerAction(Name, "Draw", "draw", 4);
                    Console.WriteLine("\n AI Discarded 4 cards, and kept their high card");
                }
                else
                {
                    // Dump!
                    for (int i = 0; i < hand.Length; i++)
                    {
                        hand[i] = null;
                    }
                    pa = new PlayerAction(Name, "Draw", "draw", 5);
                    Console.WriteLine("\n AI Discarded all 5 cards.");
                }
                #endregion
                break;

            case 2:     // We have exactly a 1 pair
                #region Section 2 (Single Pair)

                // First identify what number of a pair we have
                int pairValue = 0;
                for (int i = 2; i < 15; i++)               // Loop through every possible card number
                {
                    if (Evaluate.ValueCount(i, hand) == 2) // Thankfully we have this method
                    {
                        pairValue = i;
                        break;
                    }
                }

                // We know which number it is
                // If our high card is 10 or higher, we'll want to dump every card, except for the high card and our double
                if (highCard.Value >= 10 && highCard.Value != pairValue)     // Also check to make sure our high card isn't actually our pairValue. If it is then we'll just dump everything except for the pair
                {
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i].Value == pairValue || hand[i].Value == highCard.Value)
                        {
                            continue;
                        }

                        hand[i] = null;
                    }

                    pa = new PlayerAction(Name, "Draw", "draw", 2);
                    Console.WriteLine("\n AI has a 2 pair and has discarded everything but the 2 pair and their high card.");
                }
                else
                {
                    // If our high card isn't 10 or higher, then dump every card except for the high cards
                    // Dump!
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i].Value == pairValue)
                        {
                            continue;
                        }

                        hand[i] = null;
                    }
                    pa = new PlayerAction(Name, "Draw", "draw", 3);
                    Console.WriteLine("\n AI has a 2 pair and has discarded everything but the 2 pair.");
                }
                #endregion
                break;

            case 3:     // We have two pairs!
                #region Section 3 (Two Pairs)
                // Ok first thing we need to do is to figure out which numbers are the two pair
                int pairValue1 = 0;
                int pairValue2 = 0;
                for (int i = 2; i < 15; i++)     // Loop through every possible card number
                {
                    if (Evaluate.ValueCount(i, hand) == 2)
                    {
                        pairValue1 = i;
                        break;
                    }
                }

                // Do it again and get the second one
                for (int i = 2; i < 15; i++)     // Loop through every possible card number
                {
                    if (Evaluate.ValueCount(i, hand) == 2)
                    {
                        if (i == pairValue2)
                        {
                            continue;
                        }
                        pairValue2 = i;
                        break;
                    }
                }

                if (pairValue1 == highCard.Value || pairValue2 == highCard.Value)
                {
                    // Dump the other card and hope for a higher card
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i].Value == pairValue1 || hand[i].Value == pairValue2)
                        {
                            continue;
                        }

                        hand[i] = null;
                        pa      = new PlayerAction(Name, "Draw", "draw", 1);
                    }
                }
                else
                {
                    // Keep it! Your hand is good!
                    pa = new PlayerAction(Name, "Draw", "stand pat", 0);
                }
                #endregion
                break;

            case 4:     // Three of a kind
                #region Section 4 (Three of a Kind)
                // Pretty simple. Exactly the same as 1 pair except that it's with 3
                // First identify what number of a pair we have
                int triValue = 0;
                for (int i = 2; i < 15; i++)               // Loop through every possible card number
                {
                    if (Evaluate.ValueCount(i, hand) == 3) // Thankfully we have this method
                    {
                        pairValue = i;
                        break;
                    }
                }

                // We know which number it is
                // If our high card is 10 or higher, we'll want to dump every card, except for the high card and our tripple
                if (highCard.Value >= 10 && highCard.Value != triValue)     // Also check to make sure our high card isn't actually our trieValue. If it is then we'll just dump everything except for the tripple
                {
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i].Value == triValue || hand[i].Value == highCard.Value)
                        {
                            continue;
                        }

                        hand[i] = null;
                    }

                    pa = new PlayerAction(Name, "Draw", "draw", 1);
                    Console.WriteLine("\n AI has a tripple and has discarded everything but the 3 of a kind and their high card.");
                }
                else
                {
                    // If our high card isn't 10 or higher, then dump every card except for the high cards
                    // Dump!
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i].Value == triValue)
                        {
                            continue;
                        }

                        hand[i] = null;
                    }
                    pa = new PlayerAction(Name, "Draw", "draw", 2);
                    Console.WriteLine("\n AI has a 3 of a kind and has discarded everything but the tripple.");
                }
                #endregion
                break;

            // There's no reason for a case. Case 5 is a stroke, and we stand pat if we have a stroke
            case 8:     // 4 of a kind
                #region Section 8 (Four of a Kind)
                // Check to see if our high is high enough. If it isn't drop it and as for another.
                int theQuadNumber = hand[3].Value;
                if (theQuadNumber == highCard.Value || highCard.Value <= 10)
                {
                    // Get rid of the other card because we can do better
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i].Value == theQuadNumber)
                        {
                            continue;
                        }

                        hand[i] = null;
                    }
                    pa = new PlayerAction(Name, "Draw", "draw", 1);
                }
                #endregion
                break;
                // Any other selection is just a hold hand because we don't want to drop anything
            }


            return(pa);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Initial betting for when going first or after draw phase
        /// Can bet, check, and fold
        /// </summary>
        /// <param name="highCard"></param>
        /// <returns></returns>
        private PlayerAction InitialBetting(PlayerAction lastAct, Card highCard, int roundedEstimate)
        {
            string phase = null;

            //Get the right phase name
            if (lastAct == null)
            {
                phase = "Bet1";
            }
            else
            {
                phase = "Bet2";
            }

            switch (handStrength)
            {
            case 1:     //Junk
                if (highCard.Value >= 11)
                {
                    return(new PlayerAction(Name, phase, "bet", CalcAmount(0, false)));
                }
                else if (roundedEstimate <= handStrength)     //Check if we feel good about this hand
                {
                    return(new PlayerAction(Name, phase, "check", 0));
                }
                else     //Fold if we don't
                {
                    return(new PlayerAction(Name, phase, "fold", 0));
                }

            case 2:                                 //One pair
                if (roundedEstimate < handStrength) //Bet if we feel good about this hand
                {
                    for (int i = 2; i < 15; i++)    //Loop for pair
                    {
                        if (Evaluate.ValueCount(i, Hand) == 2)
                        {
                            if (i > 12)
                            {
                                return(new PlayerAction(Name, phase, "bet", CalcAmount(i / 2, true)));
                            }
                            else
                            {
                                return(new PlayerAction(Name, phase, "bet", CalcAmount(i / 2, false)));
                            }
                        }
                    }
                }
                else if (roundedEstimate == handStrength)     //Check if we could win this hand
                {
                    return(new PlayerAction(Name, phase, "check", 0));
                }

                return(new PlayerAction(Name, phase, "fold", 0)); //Fold if we don't feel good about this hand

            case 3:                                               //Two pair
                if (roundedEstimate < handStrength)               //Bet if we feel good about this hand
                {
                    for (int i = 15; i > 2; i--)                  //Loop for pair
                    {
                        if (Evaluate.ValueCount(i, Hand) == 2)
                        {
                            return(new PlayerAction(Name, phase, "bet", CalcAmount(i * (3 / 4), true)));
                        }
                    }
                }
                else if (roundedEstimate == handStrength)     //Check if we could win this hand
                {
                    return(new PlayerAction(Name, phase, "check", 0));
                }

                return(new PlayerAction(Name, phase, "fold", 0)); //Fold if we don't feel good about this hand

            case 4:                                               //Three of a kind
                if (roundedEstimate < handStrength)               //Bet if we feel good about this hand
                {
                    for (int i = 2; i < 15; i++)                  //Loop for pair
                    {
                        if (Evaluate.ValueCount(i, Hand) == 3)
                        {
                            return(new PlayerAction(Name, phase, "bet", CalcAmount(i, true)));
                        }
                    }
                }
                else if (roundedEstimate == handStrength)     //Check if we could win this hand
                {
                    return(new PlayerAction(Name, phase, "check", 0));
                }

                return(new PlayerAction(Name, phase, "fold", 0)); //Fold if we don't feel good about this hand

            case 5:                                               //Straight
                if (roundedEstimate < handStrength)               //Bet if we feel good about this hand
                {
                    return(new PlayerAction(Name, phase, "bet", CalcAmount(highCard.Value, false)));
                }
                else if (roundedEstimate == handStrength)     //Check if we could win this hand
                {
                    return(new PlayerAction(Name, phase, "check", 0));
                }

                return(new PlayerAction(Name, phase, "fold", 0)); //Fold if we don't feel good about this hand

            case 6:                                               //Flush
                if (roundedEstimate < handStrength)               //Bet if we feel good about this hand
                {
                    return(new PlayerAction(Name, phase, "bet", CalcAmount(highCard.Value, false)));
                }
                else if (roundedEstimate == handStrength)     //Check if we could win this hand
                {
                    return(new PlayerAction(Name, phase, "check", 0));
                }

                return(new PlayerAction(Name, phase, "fold", 0)); //Fold if we don't feel good about this hand

            case 7:                                               //Full house //Loop
                if (roundedEstimate < handStrength)               //Bet if we feel good about this hand
                {
                    for (int i = 2; i < 15; i++)                  //Loop for pair
                    {
                        if (Evaluate.ValueCount(i, Hand) == 3)
                        {
                            return(new PlayerAction(Name, phase, "bet", CalcAmount(i, true)));
                        }
                    }
                }
                else if (roundedEstimate == handStrength)     //Check if we could win this hand
                {
                    return(new PlayerAction(Name, phase, "check", 0));
                }

                return(new PlayerAction(Name, phase, "fold", 0)); //Fold if we don't feel good about this hand

            case 8:                                               //Four of a kind
                if (roundedEstimate < handStrength)               //Bet if we feel good about this hand
                {
                    for (int i = 2; i < 15; i++)                  //Loop for pair
                    {
                        if (Evaluate.ValueCount(i, Hand) == 4)
                        {
                            return(new PlayerAction(Name, phase, "bet", CalcAmount(i, true)));
                        }
                    }
                }
                else if (roundedEstimate == handStrength)     //Check if we could win this hand
                {
                    return(new PlayerAction(Name, phase, "check", 0));
                }

                return(new PlayerAction(Name, phase, "fold", 0));                                //Fold if we don't feel good about this hand

            case 9:                                                                              //Straight flush
                return(new PlayerAction(Name, phase, "bet", CalcAmount(highCard.Value, false))); //Bet because who's gonna pull a royal flush

            case 10:                                                                             //Royal flush
                return(new PlayerAction(Name, phase, "bet", CalcAmount(highCard.Value, false))); //Bet because we're UNSTOPPABLE
            }

            return(new PlayerAction(Name, phase, "fold", 0)); //Fold, but this should never happen
        }
Ejemplo n.º 9
0
        public override PlayerAction Draw(Card[] hand)
        {
            // BRANCHING BEHAVIOR TREE (?) //

            // Get hand Eval
            Card highCard = null;

            handStrength = Evaluate.RateAHand(hand, out highCard);

            // number of tossed cards (and number to be drawn)
            // pass into PlayerAction return at the end
            int removed = 0;

            // Do stuff according to handStrength
            switch (handStrength)
            {
            case 1:                                       // weakest hand: HIGH CARD
                if (highCard.Value >= 10)                 // Check the highCard's value, if highCard is a 10-J-Q-K-A
                {
                    for (int i = 0; i < hand.Length; i++) // remove everything but the high card
                    {
                        if (hand[i] == highCard)
                        {
                            continue;       // ignore if the current card is the high card
                        }
                        hand[i] = null;     // remove
                        removed++;
                    }

                    //thisAction = new PlayerAction(Name, "Draw", "draw", removed); ////////////////DO THIS AT THE END OF SWITCH?????

                    Console.WriteLine("Player 10 threw away and will draw" + removed + " cards.");
                }
                else     // if high card is not 10-J-Q-K-A then all these cards mean literally nothing, toss all
                {
                    for (int i = 0; i < hand.Length; i++)
                    {
                        hand[i] = null;
                    }

                    //thisAction = new PlayerAction(Name, "Draw", "draw", 5);///////////////////////////

                    removed = 5;
                    Console.WriteLine("Player 10 throws away its entire hand.");
                }
                break;

            case 2:                                        // 1-PAIR
                int pairValue = 0;                         // have to get the value of the 1pair, must be initialized to something

                for (int i = 2; i < 15; i++)               // check all values
                {
                    if (Evaluate.ValueCount(i, hand) == 2) // count occurences of value (once 2 are found, break from for loop)
                    {
                        pairValue = i;
                        break;
                    }
                }

                // optimize chances of getting a higher hand
                // if the high card is not one of the pair AND it is 10-J-Q-K-A
                if (highCard.Value != pairValue && highCard.Value >= 10)
                {
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i].Value == pairValue || hand[i].Value == highCard.Value)
                        {
                            continue;       // do not toss if the current card is one of the pair OR if it is the HIGH CARD (that is different from the pair in this case)
                        }
                        hand[i] = null;
                    }

                    removed = 2;
                }
                else     // otherwise toss everything that isn't the pair
                {
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i].Value == pairValue)
                        {
                            continue;
                        }
                        hand[i] = null;
                    }

                    removed = 3;
                }

                break;

            case 3:     // 2-PAIR
                // Get 2 pairs value
                int pair1Value = 0;
                int pair2Value = 0;

                // Count occurances of values and put as pair1's value
                for (int i = 2; i < 15; i++)
                {
                    if (Evaluate.ValueCount(i, hand) == 2)
                    {
                        pair1Value = i;
                        break;
                    }
                }

                // Count occurences of values and put as pair2's value
                for (int i = 2; i < 15; i++)
                {
                    if (Evaluate.ValueCount(i, hand) == 2)
                    {
                        if (i == pair1Value)
                        {
                            continue;                       // make sure to ignore pair 1
                        }
                        pair2Value = i;
                        break;
                    }
                }

                // Check if either pair's value is the high card
                if (pair1Value == highCard.Value || pair2Value == highCard.Value)
                {
                    for (int i = 0; i < hand.Length; i++)       // toss the 1 remaining card
                    {
                        if (hand[i].Value == pair1Value || hand[i].Value == pair2Value)
                        {
                            continue;
                        }
                        hand[i] = null;
                    }

                    removed = 1;
                }
                else
                {
                    // Any other factors to decide what to do????

                    // Otherwise return a stand pat action
                    return(new PlayerAction(Name, "Draw", "stand pat", 0));
                }
                break;

            case 4:     // 3-OF-A-KIND
                // Get the triple's value
                int tripleValue = 0;
                for (int i = 2; i < 15; i++)
                {
                    if (Evaluate.ValueCount(i, hand) == 3)
                    {
                        tripleValue = i;
                        break;
                    }
                }

                // optimize chances of getting a higher hand
                // if the high card is not one of the triple AND it is 10-J-Q-K-A
                if (highCard.Value != tripleValue && highCard.Value >= 10)
                {
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i].Value == tripleValue || hand[i].Value == highCard.Value)
                        {
                            continue;
                        }

                        hand[i] = null;
                    }

                    removed = 1;
                }
                else
                {
                    // otherwise, toss the cards that aren't the triple and not 10-J-Q-K-A
                    for (int i = 0; i < hand.Length; i++)
                    {
                        if (hand[i].Value == tripleValue)
                        {
                            continue;
                        }

                        hand[i] = null;
                    }

                    removed = 2;
                }
                break;

            // case 5: // STRAIGHT
            // probably not worth it to toss anything draw again, weigh this?
            // case 6: // FLUSH
            // same as STRIAGHT

            //case 7: // FULL HOUSE
            // which pair has the high card? (the triple or double?)
            // if the high card is of the triple

            // CASE 8: If 4 of a kind
            // if the diffent card is the high AND (10+)
            // weight whether or not to risk discarding the quadruple?
            // otherwise stand pat

            //case 8: // 4 of a kind
            //    // Get Quadruple value
            //    int quadValue = 0;
            //    for (int i = 2; i < 15; i++)
            //    {
            //        if (Evaluate.ValueCount(i, hand) == 4)  // when there are 4 occurances of one of the values (i)
            //        {
            //            pairValue = i;
            //            break;
            //        }
            //    }

            //    //
            //    if (quadValue == highCard.Value || highCard.Value <= 10)
            //    {
            //        // Get rid of the other card because we can do better
            //        for (int i = 0; i < hand.Length; i++)
            //        {
            //            if (hand[i].Value == quadValue)
            //                continue;

            //            hand[i] = null;
            //        }
            //        removed = 1;
            //    }
            //    break;

            case 5:
            case 6:
            case 7:
            case 8:
            case 9:     // STRAIGHT FLUSH
            case 10:    // ROYAL FLUSH
                // just stand pat like a winner
                return(new PlayerAction(Name, "Draw", "stand pat", 0));
            }

            // otherwise, do approriate action
            return(new PlayerAction(Name, "Draw", "draw", removed));
        }