diff --git a/main.py b/main.py index 8ab4156ba7625a0deadc9426444694fe977d699e..7c18079185930f9edec9806db95c8f04919364c1 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,4 @@ - - +import matplotlib.pyplot as plt class TabletteChocolat : def __init__(self, m, n): if not isinstance(m, int) or not isinstance(n, int) : @@ -25,8 +24,13 @@ class TabletteChocolat : coup = i, j return 0<= i < self.m and 0 <= j < self.n and self.tablette[i][j] == 1 - - + def coupe(self, i, j): + coup = i, j + if not self.est_possible(coup): + raise ValueError('Coup impossible') + for x in range (i, self.m): + for y in range(j, self.n): + self.tablette[x][y] = 0 t = TabletteChocolat(3, 4)