Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AP-CHMIELEWSKI-Louis
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
Louis Chmielewski
AP-CHMIELEWSKI-Louis
Commits
5984d627
Commit
5984d627
authored
1 year ago
by
Louis Chmielewski
Browse files
Options
Downloads
Patches
Plain Diff
gather stack war.py
parent
9d43c1b7
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
Tp08/card.py
+5
-23
5 additions, 23 deletions
Tp08/card.py
Tp08/war.py
+1
-1
1 addition, 1 deletion
Tp08/war.py
with
6 additions
and
24 deletions
Tp08/card.py
+
5
−
23
View file @
5984d627
...
...
@@ -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__
'
):
...
...
This diff is collapsed.
Click to expand it.
Tp08/war.py
+
1
−
1
View file @
5984d627
...
...
@@ -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
:
"""
...
...
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