// Pair else if { if (CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank() == CardsInHand.get(eCardNo.SecondCard.getCardNo()).getRank()) { ScoreHand(eHandStrength.Pair,CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank().getRank(),0,0); } else if (CardsInHand.get(eCardNo.SecondCard.getCardNo()).getRank() == CardsInHand.get(eCardNo.ThirdCard.getCardNo()).getRank()) { ScoreHand(eHandStrength.Pair,CardsInHand.get(eCardNo.SecondCard.getCardNo()).getRank().getRank(),0,0); } else if (CardsInHand.get(eCardNo.ThirdCard.getCardNo()).getRank() == CardsInHand.get(eCardNo.FourthCard.getCardNo()).getRank()) { ScoreHand(eHandStrength.Pair,CardsInHand.get(eCardNo.ThirdCard.getCardNo()).getRank().getRank(),0,0); } else if (CardsInHand.get(eCardNo.FourthCard.getCardNo()).getRank() == CardsInHand.get(eCardNo.FifthCard.getCardNo()).getRank()) { ScoreHand(eHandStrength.Pair,CardsInHand.get(eCardNo.FourthCard.getCardNo()).getRank().getRank(),0,0); } }
public void EvalHand() { // Evaluates if the hand is a flush and/or straight then figures out // the hand's strength attributes // Sort the cards! Collections.sort(CardsInHand, Card.CardRank); // Ace Evaluation if (CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank() == eRank.ACE) { Ace = true; } // Flush Evaluation if (CardsInHand.get(eCardNo.FirstCard.getCardNo()).getSuit() == CardsInHand .get(eCardNo.SecondCard.getCardNo()).getSuit() && CardsInHand.get(eCardNo.FirstCard.getCardNo()).getSuit() == CardsInHand .get(eCardNo.ThirdCard.getCardNo()).getSuit() && CardsInHand.get(eCardNo.FirstCard.getCardNo()).getSuit() == CardsInHand .get(eCardNo.FourthCard.getCardNo()).getSuit() && CardsInHand.get(eCardNo.FirstCard.getCardNo()).getSuit() == CardsInHand .get(eCardNo.FifthCard.getCardNo()).getSuit()) { Flush = true; } else { Flush = false; } // five of a Kind if (CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank() == CardsInHand .get(eCardNo.FifthCard.getCardNo()).getRank()) { ScoreHand(eHandStrength.FiveOfAKind, CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank() .getRank(), 0, 0); } // Straight Evaluation else if (Ace) { // Looks for Ace, King, Queen, Jack, 10 if (CardsInHand.get(eCardNo.SecondCard.getCardNo()).getRank() == eRank.KING && CardsInHand.get(eCardNo.ThirdCard.getCardNo()).getRank() == eRank.QUEEN && CardsInHand.get(eCardNo.FourthCard.getCardNo()) .getRank() == eRank.JACK && CardsInHand.get(eCardNo.FifthCard.getCardNo()).getRank() == eRank.TEN) { Straight = true; // Looks for Ace, 2, 3, 4, 5 } else if (CardsInHand.get(eCardNo.FifthCard.getCardNo()).getRank() == eRank.TWO && CardsInHand.get(eCardNo.FourthCard.getCardNo()) .getRank() == eRank.THREE && CardsInHand.get(eCardNo.ThirdCard.getCardNo()).getRank() == eRank.FOUR && CardsInHand.get(eCardNo.SecondCard.getCardNo()) .getRank() == eRank.FIVE) { Straight = true; } else { Straight = false; } // Looks for straight without Ace } else if (CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank() .getRank() == CardsInHand.get(eCardNo.SecondCard.getCardNo()) .getRank().getRank() + 1 && CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank() .getRank() == CardsInHand .get(eCardNo.ThirdCard.getCardNo()).getRank().getRank() + 2 && CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank() .getRank() == CardsInHand .get(eCardNo.FourthCard.getCardNo()).getRank() .getRank() + 3 && CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank() .getRank() == CardsInHand .get(eCardNo.FifthCard.getCardNo()).getRank().getRank() + 4) { Straight = true; } else { Straight = false; } // Evaluate Royal Flush if (Straight == true && Flush == true && CardsInHand.get(eCardNo.FifthCard.getCardNo()).getRank() == eRank.TEN && Ace) { ScoreHand(eHandStrength.RoyalFlush, 0, 0, 0); } // Straight Flush else if (Straight == true && Flush == true) { ScoreHand(eHandStrength.StraightFlush, CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank() .getRank(), 0, 0); } // Four of a Kind if { if (CardsInHand.get(eCardNo.FirstCard.getCardNo()).getRank() == CardsInHand.get(eCardNo.FourthCard.getCardNo()).getRank()) { ScoreHand(eHandStrength.FourOfAKind,0,0,0); } else if (CardsInHand.get(eCardNo.SecondCard.getCardNo()).getRank() == CardsInHand.get(eCardNo.FifthCard.getCardNo()).getRank()) { ScoreHand(eHandStrength.FourOfAKind,0,0,0); } } // Full House else if {