Permalink
Browse files

Merge branch 'master' of http://github.com/jbass86/JTJ_Holdem

  • Loading branch information...
2 parents 4251098 + f0ee4f3 commit 63b06f3382a4590e785d058dd698a46513ed676c @jbass86 committed Dec 9, 2013
@@ -179,10 +179,11 @@ public static PokerHand determineThreeOfAKind(final List<ICard> pHand){
List <ICard> kickers = new ArrayList<ICard>(pHand);
kickers.removeAll(numbers.get(number));
Collections.sort(kickers);
- while (kickers.size() > 3){
+ while (kickers.size() > 2){
kickers.remove(0);
}
hand = new PokerHand(EPokerHand.THREE_OF_A_KIND, numbers.get(number), kickers);
+ break;
}
}
return hand;
@@ -256,7 +256,34 @@ public void testTwoPair3(){
verifyCardList(hand.getKickers(), kickers);
}
+ @Test
+ public void test3OfaKind1(){
+
+ List<ICard> initialCards = new ArrayList<ICard>();
+ initialCards.add(new Card(ECardNumber.KING, ECardSuit.CLUBS));
+ initialCards.add(new Card(ECardNumber.KING, ECardSuit.SPADES));
+ initialCards.add(new Card(ECardNumber.FOUR, ECardSuit.HEARTS));
+ initialCards.add(new Card(ECardNumber.KING, ECardSuit.DIAMONDS));
+ initialCards.add(new Card(ECardNumber.SEVEN, ECardSuit.DIAMONDS));
+ initialCards.add(new Card(ECardNumber.THREE, ECardSuit.CLUBS));
+ initialCards.add(new Card(ECardNumber.ACE, ECardSuit.SPADES));
+ List<ICard> handCards = new ArrayList<ICard>();
+ handCards.add(new Card(ECardNumber.KING, ECardSuit.CLUBS));
+ handCards.add(new Card(ECardNumber.KING, ECardSuit.SPADES));
+ handCards.add(new Card(ECardNumber.KING, ECardSuit.DIAMONDS));
+ List<ICard> kickers = new ArrayList<ICard>();
+ kickers.add(new Card(ECardNumber.ACE, ECardSuit.SPADES));
+ kickers.add(new Card(ECardNumber.SEVEN, ECardSuit.DIAMONDS));
+
+ PokerHand hand = PokerHandUtility.determineBestHand(initialCards);
+
+ Assert.assertEquals(hand.getHand(), EPokerHand.THREE_OF_A_KIND);
+ verifyCardList(hand.getCards(), handCards);
+ verifyCardList(hand.getKickers(), kickers);
+ }
+
+
private static void verifyCardList(final List<ICard> pList1, final List<ICard> pList2){
for (ICard card : pList1){
Assert.assertEquals(pList2.contains(card), true);
@@ -34,6 +34,7 @@
public SlickTest(String gamename){
super(gamename);
testDeck.populateDeck(false);
+ testDeck.shuffleDeck();
}
@Override

0 comments on commit 63b06f3

Please sign in to comment.