Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Examen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LITAIZE Leo
Examen
Commits
63a68bc6
Commit
63a68bc6
authored
5 months ago
by
Leo Litaize
Browse files
Options
Downloads
Patches
Plain Diff
Question 7..
parent
c963b29e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+19
-9
19 additions, 9 deletions
main.py
with
19 additions
and
9 deletions
main.py
+
19
−
9
View file @
63a68bc6
import
matplotlib.pyplot
as
plt
from
itertools
import
chain
as
ch
import
itertools
as
it
class
TabletteChocolat
:
def
__init__
(
self
,
m
,
n
):
self
.
m
=
m
...
...
@@ -7,7 +7,7 @@ class TabletteChocolat:
try
:
self
.
m
==
int
and
self
.
n
==
int
except
:
TypeError
,
print
(
"
Rentrer des entiers
"
)
raise
TypeError
(
"
Rentrer des entiers
"
)
def
__str__
(
self
):
return
"
(
"
+
str
(
self
.
m
)
+
"
x
"
+
str
(
self
.
n
)
+
"
)
"
...
...
@@ -22,21 +22,31 @@ class TabletteChocolat:
yield
(
i
,
j
)
else
:
None
#return itertools.chain ??????
#help(itertools.chain) ??????
return
it
.
chain
#?
def
est_possible
(
self
,
i
,
j
):
for
a
in
list
(
g
):
if
a
==
(
i
,
j
):
return
"
Ce coup est possible
"
for
a
in
list
(
g
):
#on parcoure la liste des coups possibles
if
a
==
(
i
,
j
):
#on verifie si le coup en parametre est dans cette derniere
return
"
Ce coup est possible
"
#et on repond
else
:
return
"
Ce coup n est pas possible
"
#def coupe(self,i,j):
#Une instance est lorsque lon met une vraie valeur a un objet
def
plot
(
self
):
plt
.
axis
(
'
equal
'
)
x
,
y
=
(
i
,
j
)
plt
.
fill
(
x
,
y
,
"
D5B799
"
)
#un polygone bleu
plt
.
fill
(
x
,
y
,
"
b
"
,
x2
,
y2
,
"
r
"
)
#deux polygone bleu et rouge
plt
.
show
plt
.
close
#absolument pas fini en 1h30 cetait un peu juste je pense
#def demander_coup(self):
help
(
plt
.
fill
)
#help()
t
=
TabletteChocolat
(
3
,
4
)
print
(
t
)
TabletteChocolat
(
4
,
3
)
...
...
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