Skip to content
Snippets Groups Projects
Commit 5984d627 authored by Louis Chmielewski's avatar Louis Chmielewski
Browse files

gather stack war.py

parent 9d43c1b7
No related branches found
No related tags found
No related merge requests found
......@@ -155,23 +155,14 @@ class Card(object):
return True if self don't equal card
False otherwise
"""
return (self.value != card.value) and (self.color != card.color)
return (self.value != card.value) or (self.color != card.color)
def __lt__(self, card: Card) -> bool:
"""
return True if self is strictly inferior to card
False otherwise
"""
if self.value < card.value:
res = True
elif self.value == card.value:
if self.color < card.color:
res = True
else:
res = False
else:
res = False
return res
return self.compare(card) == -1
def __le__(self, card: Card) -> bool:
......@@ -179,7 +170,7 @@ class Card(object):
return True if self is inferior or equal to card
False otherwise
"""
return self.value <= card.value
return self.compare(card) <= 0
def __gt__(self, card: Card) -> bool:
......@@ -187,23 +178,14 @@ class Card(object):
return True if self is strictly superior to card
False otherwise
"""
if self.value > card.value:
res = True
elif self.value == card.value:
if self.color > card.color:
res = True
else:
res = False
else:
res = False
return res
return self.compare(card) == 1
def __ge__(self, card: Card) -> bool:
"""
return True if self is superior or equal to card
False otherwise
"""
return self.value >= card.value
return self.compare(card) >= 0
if (__name__ == '__main__'):
......
......@@ -81,7 +81,7 @@ def play_one_round(m1: ApQueue, m2: ApQueue, pile: ApStack) -> None:
precondition : m1 et m2 ne sont pas vides
"""
...
def play(n_card: int, n_round: int) -> None:
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment