Skip to content
Snippets Groups Projects
Commit c7ac3de2 authored by Fares_AZOUAOUI's avatar Fares_AZOUAOUI
Browse files

petite correction de la méthode coups_possibles

parent e230a76e
No related branches found
No related tags found
No related merge requests found
from itertools import chain from itertools import chain
import matplotlib.pyplot as plt #import matplotlib.pyplot as plt
class TabletteChocolat : class TabletteChocolat :
def __init__(self, m:int, n:int): def __init__(self, m:int, n:int):
...@@ -27,9 +27,9 @@ class TabletteChocolat : ...@@ -27,9 +27,9 @@ class TabletteChocolat :
''' '''
resultat = [] resultat = []
for i in range (1 ,self.n) : for i in range (1 ,self.n) :
resultat.append(i, 0) resultat.append((i, 0))
for k in range (1, self.m) : for k in range (1, self.m) :
resultat.append(0, j) resultat.append((0, k))
return chain(resultat) return chain(resultat)
def est_possible(self, couple_i_j) : def est_possible(self, couple_i_j) :
...@@ -41,13 +41,16 @@ class TabletteChocolat : ...@@ -41,13 +41,16 @@ class TabletteChocolat :
def plot(self) : def plot(self) :
plt.gca().set_aspect('equal') plt.gca().set_aspect('equal')
plt.axis('off') plt.axis('off')
plt.fill([0, self.m, self.n, 0],) plt.fill([0, self.m, self.n, 0] , [0, 0, self.m, self.n] , color='#D5B799')
plt.show
t = TabletteChocolat(3,4) t = TabletteChocolat(3,4)
print(t) print(t)
print(list(t.coups_possibles()))
if __name__ == "main" : if __name__ == "main" :
import doctest import doctest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment