コード例 #1
0
 def __lt__(self, other):
     """
     self < other
     
     Returns true if the Card 'self' is less than Card 'other'.
     """
     if self.suitRank == False:
         return values.index(self.value) < values.index(other.value)
     else:
         pass
コード例 #2
0
 def __ge__(self, other):
     """
     self >= other
     
     Returns true if the Card 'self' is greater than or equal to Card 'other'.
     """
     if self.suitRank == False:
         return values.index(self.value) >= values.index(other.value)
     else:
         pass
コード例 #3
0
 def __le__(self, other):
     """
     self <= other
     
     Returns true if the Card 'self' is less than or equal to Card 'other'.
     """
     if self.suitRank == False:
         return values.index(self.value) <= values.index(other.value)
     else:
         pass
コード例 #4
0
 def __ne__(self, other):
     """
     self != other
     
     Returns true if the Cards are not equal.
     """
     if isinstance(other, Card):
         if self.suitRank == False:
             return values.index(self.value) != values.index(other.value)
         else:
             pass
     return False
コード例 #5
0
def comparehands(hand1, hand2):
    player1func, player1val = getHandRankFunc(hand1)
    player2func, player2val = getHandRankFunc(hand2)

    if player1func < player2func:
        return True
    elif player1func > player2func:
        return False
    else:
        player1index = values.index(player1val[0])
        player2index = values.index(player2val[0])
        if player1index > player2index:
            return True
        elif player1index < player2index:
            return False
        else:
            return None
コード例 #6
0
def testercomparehands(hand1, hand2):
    player1func, player1val = getHandRankFunc(hand1)
    player2func, player2val = getHandRankFunc(hand2)
    totalhandcount[player1func] += 1
    totalhandcount[player2func] += 1
    player1total[player1func] += 1
    player2total[player2func] += 1

    if player1func < player2func:
        return True, player1func
    elif player1func > player2func:
        return False, player2func
    else:
        player1index = values.index(player1val[0])
        player2index = values.index(player2val[0])
        if player1index > player2index:
            return True, player1func
        elif player1index < player2index:
            return False, player2func
        else:
            return None, -1