Select Git revision
models.py 1.10 KiB
class Meuble():
def __init__(self,x_pos,y_pos):
self.couleur = '0a0a2a'
self.x_pos = x_pos
self.y_pos = y_pos
self.forme = 'rectangle'
self.orientation = (1,0) #dx,dy
self.matiere = 'bois'
self.attributs_special_heritage()
def attributs_special_heritage(self):
pass
def tourner(self,new_orientation):
(dx,dy)=new_orientation
if dx in [-1,0,+1] and dy in [-1,0,+1] and dx*dy!=0:
self.orientation = (dx,dy)
def bouger(self,x_pos,y_pos):
if type(x_pos)==type(0) and type(y_pos)==type(0):
self.x_pos = x_pos
self.y_pos = y_pos
else:
raise Exception ("Invalid coordinates")
class Table(Meuble):
def attributs_special_heritage(self):
self.objets=[]
self.descente_n_plus_1()
def descente_n_plus_1(self):
pass
class Table_Ext(Table):
def descente_n_plus_1(self):
self.parasol=True
class Lit(Meuble):
def attributs_special_heritage(self):
self.occupe=False
table_ext=Table_Ext(5,5)
print(table_ext.parasol)