From 9d43c1b724ad526e83149d696bc54b16ce873ba3 Mon Sep 17 00:00:00 2001
From: Louis Chmielewski <louis.chmielewski@icloud.com>
Date: Wed, 3 Apr 2024 11:29:30 +0200
Subject: [PATCH]  eq, neq, lt, le, gt, ge in card.py

---
 Tp08/card.py | 32 ++++++++++++++++++++++++++------
 Tp08/war.py  |  4 +++-
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/Tp08/card.py b/Tp08/card.py
index 8e20fc2..30af6d7 100755
--- a/Tp08/card.py
+++ b/Tp08/card.py
@@ -148,42 +148,62 @@ class Card(object):
         return True if self equals card
                False otherwise
         """
-        ...
+        return (self.value == card.value) and (self.color == card.color) 
 
     def __neq__(self, card: Card) -> bool:
         """
         return True if self don't equal card
                False otherwise
         """
-        ...
+        return (self.value != card.value) and (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
+        
 
     def __le__(self, card: Card) -> bool:
         """
         return True if self is inferior or equal to card
                False otherwise
         """
-        ...
+        return self.value <= card.value
+            
 
     def __gt__(self, card: Card) -> bool:
         """
         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
 
     def __ge__(self, card: Card) -> bool:
         """
         return True if self is superior or equal to card
                False otherwise
         """
-        ...
+        return self.value >= card.value
 
 
 if (__name__ == '__main__'):
diff --git a/Tp08/war.py b/Tp08/war.py
index fa3c4a2..c2020bb 100755
--- a/Tp08/war.py
+++ b/Tp08/war.py
@@ -62,7 +62,9 @@ def gather_stack(main: ApQueue, pile: ApStack) -> None:
     $$$ all( main.dequeue() == cartes[ 3 - i ] for i in range(3))
     True
     """
-    
+    while not pile.is_empty():
+        main.enqueue(pile.pop())
+    return main
 
 def play_one_round(m1: ApQueue, m2: ApQueue, pile: ApStack) -> None:
     """
-- 
GitLab