diff --git a/main.py b/main.py index cc7028322dce946c2b12dbfead34bcb9c3ffaba6..7742a21b6142065041516a9a30faae9e8b00ae05 100644 --- a/main.py +++ b/main.py @@ -38,6 +38,17 @@ class TabletteChocolat: plt.show() plt.close() + def demander_coup(self): + x = input("Couper des lignes (l) ou colonnes (c) ? -> ") + if x == "l": + n = input("Combien de lignes à couper ? Choix possibles : " + str(list(range(1, self.m))) + " -> ") + return t.coupe(int(n), 0) + if x == "c": + n = input("Combien de colonnes à couper ? Choix possibles : " + str(list(range(1, self.n))) + " -> ") + return t.coupe(0, int(n)) + else: + return "Il faut répondre l ou c !" + # Programme principal t = TabletteChocolat(4, 3) @@ -46,4 +57,5 @@ TabletteChocolat(3, 4) print(t.coups_possibles()) print(t.est_possible(0, 1)) print(t.coupe(3, 1)) -t.plot() \ No newline at end of file +t.plot() +print(t.demander_coup()) \ No newline at end of file