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
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
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
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
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
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