From 5984d6275d496d92ce8ed1a36499b8d1d9eaaf45 Mon Sep 17 00:00:00 2001
From: Louis Chmielewski <louis.chmielewski@icloud.com>
Date: Wed, 3 Apr 2024 11:44:39 +0200
Subject: [PATCH] gather stack war.py

---
 Tp08/card.py | 28 +++++-----------------------
 Tp08/war.py  |  2 +-
 2 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/Tp08/card.py b/Tp08/card.py
index 30af6d7..9031156 100755
--- a/Tp08/card.py
+++ b/Tp08/card.py
@@ -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__'):
diff --git a/Tp08/war.py b/Tp08/war.py
index c2020bb..d7173bd 100755
--- a/Tp08/war.py
+++ b/Tp08/war.py
@@ -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:
     """
-- 
GitLab