Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ap-belfadel-mohamed
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mohamed Belfadel
ap-belfadel-mohamed
Commits
90c39fdf
Commit
90c39fdf
authored
1 year ago
by
Belfadel Mohamed
Browse files
Options
Downloads
Patches
Plain Diff
gather_stack
parent
ee64eeaf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
TP9/card.py
+1
-1
1 addition, 1 deletion
TP9/card.py
TP9/war.py
+4
-3
4 additions, 3 deletions
TP9/war.py
with
5 additions
and
4 deletions
TP9/card.py
+
1
−
1
View file @
90c39fdf
...
@@ -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
:
"""
"""
...
...
This diff is collapsed.
Click to expand it.
TP9/war.py
+
4
−
3
View file @
90c39fdf
...
@@ -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
:
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment