Beispiel #1
0
 def getGroupsOfSuits(self, hand):
     allGroupsOfSuites = []
     groupOfSameSuite = Hand()
     hand.sort()
     previousSuit = ""
     for card in hand.getHand():
         if card[0] == previousSuit:
             groupOfSameSuite.append(card)
         else:
             if groupOfSameSuite.size() > 0:
                 allGroupsOfSuites.append(groupOfSameSuite.copy())
             groupOfSameSuite.clear()
             groupOfSameSuite.append(card)
         previousSuit = card[0]
     allGroupsOfSuites.append(groupOfSameSuite.copy())
     return allGroupsOfSuites
Beispiel #2
0
 def getRuns(self, hand):
     allRuns = []
     currentRun = Hand()
     previousSuit = ""
     previousFace = 0
     hand.sort()
     hand.convertFacesToNumbers()
     for card in hand.getHand():
         if card[0] == previousSuit and int(card[1:3]) == previousFace + 1:
             currentRun.append(card)
         else:
             if currentRun.size() > 1:
                 currentRun.convertNumbersToFaces()
                 allRuns.append(currentRun.copy())
             currentRun.clear()
             currentRun.append(card)
         previousSuit = card[0]
         previousFace = int(card[1:3])
     hand.convertNumbersToFaces()
     return allRuns