Skip to content
Snippets Groups Projects
Commit 90c39fdf authored by Belfadel Mohamed's avatar Belfadel Mohamed
Browse files

gather_stack

parent ee64eeaf
No related branches found
No related tags found
No related merge requests found
...@@ -149,7 +149,7 @@ class Card(object): ...@@ -149,7 +149,7 @@ class Card(object):
return True if self equals card return True if self equals card
False otherwise False otherwise
""" """
... return (self.value == card.value) and (self.color == card.color)
def __neq__(self, card: Card) -> bool: def __neq__(self, card: Card) -> bool:
""" """
......
...@@ -59,15 +59,16 @@ def gather_stack(main: ApQueue, pile: ApStack) -> None: ...@@ -59,15 +59,16 @@ def gather_stack(main: ApQueue, pile: ApStack) -> None:
$$$ cartes = Card.deck(4) $$$ cartes = Card.deck(4)
$$$ main = ApQueue() $$$ main = ApQueue()
$$$ pile = ApStack() $$$ pile = ApStack()
$$$ for c in cartes: $$$ for c in cartes: pile.push(c)
pile.push(c)
$$$ gather_stack( main, pile ) $$$ gather_stack( main, pile )
$$$ len( main ) == 4 $$$ len( main ) == 4
True True
$$$ all( main.dequeue() == cartes[ 3 - i ] for i in range(3)) $$$ all( main.dequeue() == cartes[ 3 - i ] for i in range(3))
True True
""" """
... while not pile.is_empty():
main.enqueue(pile.pop())
return main
def play_one_round(m1: ApQueue, m2: ApQueue, pile: ApStack) -> None: def play_one_round(m1: ApQueue, m2: ApQueue, pile: ApStack) -> None:
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment