Esempio n. 1
0
 def isFullHouse(self):
     """ generated source for method isFullHouse """
     highestThreeOfAKind = CardsUtil.getHighestOfSameRank(PokerHand.THREE_OF_A_KIND.getCardsRequired(), self.cards)
     if len(highestThreeOfAKind) == 0:
         raise Exception("No three of a kind found for Full House")
     highestTwoOfAKind = CardsUtil.getHighestOfSameRankExcluding(PokerHand.ONE_PAIR.getCardsRequired(), self.cards, highestThreeOfAKind[0].getRank())
     if len(highestTwoOfAKind):
         raise Exception("No two of a kind found for Full House")
     fullHouse = highestThreeOfAKind + highestTwoOfAKind
     return Hand(fullHouse, PokerHand.FULL_HOUSE)
Esempio n. 2
0
 def isTwoPairs(self):
     """ generated source for method isTwoPairs """
     highestTwoOfAKind = CardsUtil.getHighestOfSameRank(PokerHand.ONE_PAIR.getCardsRequired(), self.cards)
     if len(highestTwoOfAKind) == 0:
         raise Exception("No two of a kind found in Two pairs")
     nextHighestTwoOfAKind =CardsUtil.getHighestOfSameRankExcluding(PokerHand.ONE_PAIR.getCardsRequired(), self.cards, highestTwoOfAKind[0].getRank())
     if len(nextHighestTwoOfAKind) == 0:
         raise Exception("No second two of a kind found in Two pairs")
     twoPairs = highestTwoOfAKind + nextHighestTwoOfAKind
     twoPairs = twoPairs + CardsUtil.getHighestSortedAndExclude(5 - PokerHand.TWO_PAIRS.getCardsRequired(), self.cards, twoPairs)
     return Hand(twoPairs, PokerHand.TWO_PAIRS)