python3 __cmp__ fix

This commit is contained in:
Gordon Shumway 2019-03-08 22:18:42 -05:00 committed by GitHub
parent ceb676e50b
commit 14b05177ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 2 deletions

View File

@ -417,8 +417,26 @@ class Worddle(BaseGame):
self.unique = unique if unique else set()
self.dup = dup if dup else set()
def __cmp__(self, other):
return cmp(self.get_score(), other.get_score())
def __eq__(self, other):
return ((self.get_score()) == (other.get_score()))
def __ne__(self, other):
return ((self.get_score()) != (other.get_score()))
def __lt__(self, other):
return ((self.get_score()) < (other.get_score()))
def __le__(self, other):
return ((self.get_score()) <= (other.get_score()))
def __gt__(self, other):
return ((self.get_score()) > (other.get_score()))
def __ge__(self, other):
return ((self.get_score()) >= (other.get_score()))
def __repr__(self):
return "%s %s" % (self.get_score(), other.get_score())
def get_score(self):
score = 0