Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Examen QH
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
HARTMAN Quentin
Examen QH
Commits
0ccf1984
Commit
0ccf1984
authored
5 months ago
by
BiocheH
Browse files
Options
Downloads
Patches
Plain Diff
commit final touch + push + inversion lignes/colonnes au dernier moment
parent
e7603273
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
+26
-21
26 additions, 21 deletions
main.py
with
26 additions
and
21 deletions
main.py
+
26
−
21
View file @
0ccf1984
...
...
@@ -50,13 +50,16 @@ class TabletteChocolat:
return
TabletteChocolat
(
self
.
m
-
couple
[
0
],
self
.
n
-
couple
[
1
])
def
plot
(
self
):
'''
affiche la tablette courante
'''
plt
.
gca
().
set_aspect
(
'
equal
'
)
plt
.
axis
(
'
off
'
)
plt
.
fill
([
0
,
self
.
m
,
self
.
m
,
0
],
[
0
,
0
,
self
.
n
,
self
.
n
],
color
=
'
#D5B799
'
)
for
i
in
range
(
self
.
m
):
for
j
in
range
(
self
.
n
):
plt
.
fill
([
0
,
self
.
n
,
self
.
n
,
0
],
[
0
,
0
,
self
.
m
,
self
.
m
],
color
=
'
#D5B799
'
)
for
i
in
range
(
self
.
n
):
for
j
in
range
(
self
.
m
):
plt
.
plot
([
i
+
0.1
,
i
+
0.9
,
i
+
0.9
,
i
+
0.1
,
i
+
0.1
],
[
j
+
0.1
,
j
+
0.1
,
j
+
0.9
,
j
+
0.9
,
j
+
0.1
],
color
=
'
#554739
'
)
plt
.
fill
([
self
.
m
-
0.9
,
self
.
m
-
0.1
,
self
.
m
-
0.1
,
self
.
m
-
0.9
],
[
0.1
,
0.1
,
0.9
,
0.9
],
color
=
'
#554739
'
)
plt
.
fill
([
self
.
n
-
0.9
,
self
.
n
-
0.1
,
self
.
n
-
0.1
,
self
.
n
-
0.9
],
[
0.1
,
0.1
,
0.9
,
0.9
],
color
=
'
#554739
'
)
plt
.
show
()
def
demander_coup
(
self
):
...
...
@@ -69,21 +72,21 @@ class TabletteChocolat:
elif
self
.
m
==
1
and
self
.
n
==
1
:
print
(
'
on ne peut couper plus rien couper
'
)
return
self
elif
self
.
m
==
1
:
elif
self
.
n
==
1
:
coup
=
'
l
'
print
(
'
on ne peut couper plus que des lignes
'
)
elif
self
.
n
==
1
:
elif
self
.
m
==
1
:
coup
=
'
c
'
print
(
'
on ne peut couper plus que des colonnes
'
)
if
coup
==
'
l
'
:
print
(
'
voici les coups possibles :
'
,
'
,
'
.
join
(
str
(
i
)
+
'
lig
nes
'
for
i
in
range
(
1
,
self
.
n
)))
if
coup
==
'
c
'
:
print
(
'
voici les coups possibles :
'
,
'
,
'
.
join
(
str
(
i
)
+
'
colon
nes
'
for
i
in
range
(
1
,
self
.
n
)))
while
not
1
<=
taille_coupe
<=
self
.
n
-
1
:
taille_coupe
=
int
(
input
(
'
combien de
lig
nes couper ?
'
))
taille_coupe
=
int
(
input
(
'
combien de
colon
nes couper ?
'
))
return
self
.
coupe
((
0
,
taille_coupe
))
if
coup
==
'
c
'
:
print
(
'
voici les coups possibles :
'
,
'
,
'
.
join
(
str
(
i
)
+
'
colon
nes
'
for
i
in
range
(
1
,
self
.
m
)))
if
coup
==
'
l
'
:
print
(
'
voici les coups possibles :
'
,
'
,
'
.
join
(
str
(
i
)
+
'
lig
nes
'
for
i
in
range
(
1
,
self
.
m
)))
while
not
1
<=
taille_coupe
<=
self
.
m
-
1
:
taille_coupe
=
int
(
input
(
'
combien de
colon
nes couper ?
'
))
taille_coupe
=
int
(
input
(
'
combien de
lig
nes couper ?
'
))
return
self
.
coupe
((
taille_coupe
,
0
))
...
...
@@ -116,17 +119,19 @@ def tablettes_gagnantes_pour_Ursula(m: int, n: int):
return
tablettes
A
=
TabletteChocolat
(
1
,
2
)
# Liste des tests effectués :
A
=
TabletteChocolat
(
1
,
2
)
# q1, q2
B
=
TabletteChocolat
(
4
,
8
)
print
(
A
)
print
(
A
)
# q3
print
(
B
)
print
(
list
(
B
.
coups_possibles
()))
print
(
list
(
B
.
coups_possibles
()))
# q4
print
(
B
.
coups_possibles
())
print
(
B
.
est_possible
((
3
,
0
)))
print
(
B
.
est_possible
((
3
,
0
)))
# q5
print
(
B
.
est_possible
((
3
,
2
)))
print
(
B
.
coupe
((
0
,
5
)))
print
(
B
.
coupe
((
0
,
5
)))
# q6
print
(
B
.
coupe
((
2
,
0
)))
#B.plot()
#B.demander_coup().plot()
print
(
tablettes_gagnantes_pour_Ursula
(
8
,
6
))
jouer
(
5
,
5
)
\ No newline at end of file
#B.plot() # q7
#B.demander_coup().plot() # q8, q9
print
(
tablettes_gagnantes_pour_Ursula
(
8
,
6
))
# technically q12
jouer
(
5
,
5
)
# q10
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