Skip to content
Snippets Groups Projects
Commit e9e42a67 authored by BAHOU Mehdi's avatar BAHOU Mehdi
Browse files

Question 6

parent 630616ba
No related branches found
No related tags found
No related merge requests found
...@@ -44,6 +44,17 @@ class TabletteChocolat: ...@@ -44,6 +44,17 @@ class TabletteChocolat:
return True return True
else: else:
return False return False
def coupe(self, i, j):
"""
Doc de coupe
:param i: int nombre de ligne enlevé
:param j: int nombre de colonne enlevé
:return: TabletteChocolat
"""
if self.est_possible(i,j):
return TabletteChocolat(self.m - i, self.n - j)
else:
raise ValueError('Coup impossible')
#Programme Principal #Programme Principal
Tablette = TabletteChocolat(3,4) Tablette = TabletteChocolat(3,4)
...@@ -51,3 +62,4 @@ print(Tablette) ...@@ -51,3 +62,4 @@ print(Tablette)
g= Tablette.coups_possibles() g= Tablette.coups_possibles()
print(list(g)) print(list(g))
print(Tablette.est_possible(1,0)) print(Tablette.est_possible(1,0))
biscuit = Tablette.coupe(1,0)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment