Skip to content
Snippets Groups Projects
Commit 5cfa1de0 authored by GUYOT Maelis's avatar GUYOT Maelis
Browse files

question6

parent d0e187fc
Branches
No related tags found
No related merge requests found
#Imports éventuels #Imports éventuels
import itertools as it import itertools as it
import matplotlib as plt
#AJouts de fonctions et méthode #AJouts de fonctions et méthode
...@@ -17,17 +17,24 @@ class TabletteChocolat:#création de la classe ...@@ -17,17 +17,24 @@ class TabletteChocolat:#création de la classe
return "Tablette de chocolat de"+str(self.m)+"x"+str(self.n) return "Tablette de chocolat de"+str(self.m)+"x"+str(self.n)
def coups_possibles(self): def coups_possibles(self):
h=()
g=[] g=[]
for i in range(self.m): for h in it.chain(range(self.m),range(self.n)):
for j in range(self.n): g.append(h)
g.append((i,j)) return
return g
def est_possible(self,i,j): def est_possible(self,i,j):
if isinstance((i,j),self.coups_possibles()): if isinstance((i,j),self.coups_possibles()):
return True return True
def coupe(self,i,j):
return self.coups_possibles()
#Programme principal #Programme principal
#if __name__=='main': if True: # __name__=='main':
t = TabletteChocolat(3,4) t = TabletteChocolat(3,4)
g = t.coups_possibles() g = t.coups_possibles()
print(t) print(t)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment