diff --git a/examen.py b/examen.py index a8311fa7bcefefd78446a1552a366fe192623f77..3672d32590ce173886522f90cd556a16727b138c 100644 --- a/examen.py +++ b/examen.py @@ -59,20 +59,27 @@ class TabletteChocolat: def plot(self): m=self.m n=self.n - plt.fill([0,m,m,0,0],[0,0,n,n,0], color='#D5B799') + plt.fill([0,0,n,n,0],[0,m,m,0,0], color='#D5B799') for i in range(m): for j in range(n): - X = [i+0.1, i+0.1, i+0.9, i+0.9, i+0.1] - Y = [j+0.1, j+0.9, j+0.9, j+0.1, j+0.1] + X = [j+0.1, j+0.9, j+0.9, j+0.1, j+0.1] + Y = [i+0.1, i+0.1, i+0.9, i+0.9, i+0.1] plt.plot(X,Y, color='#000') - n = 0 - m -=1 - plt.fill([m+0.1, m+0.1, m+0.9, m+0.9, m+0.1], [n+0.1, n+0.9, n+0.9, n+0.1, n+0.1], color='#000') + m =0 + n -= 1 + plt.fill([n+0.1, n+0.9, n+0.9, n+0.1, n+0.1], [m+0.1, m+0.1, m+0.9, m+0.9, m+0.1], color='#000') plt.gca().set_aspect('equal') plt.axis('off') plt.show() plt.close() - + def demander_coup(self): + demande = input('Couper des lignes (l) ou colonnes (c) ?') + if demande == 'l': + reponse = int(input("Combien ? En sachant qu'il y a " + str(self.m-1) +" possibilités")) + return (reponse,0) + elif demande == 'c': + reponse = int(input("Combien ? En sachant qu'il y a "+ str(self.n - 1)+ " possibilités")) + return (0, reponse) #Programme Principal @@ -82,4 +89,5 @@ g= Tablette.coups_possibles() print(list(g)) print(Tablette.est_possible(1,0)) biscuit = Tablette.coupe(1,0) -Tablette.plot() \ No newline at end of file +Tablette.plot() +print(Tablette.demander_coup()) \ No newline at end of file