Code : Tout sélectionner
class Point:
def init (self, abscisse, ordonnee):
self.a = abscisse
self.b = ordonnee
def __str__(self):
return f"({self.a}, {self.b})"
def distAB(self, autrepoint):
return pow((pow((autrepoint.a - self.a), 2) + pow((autrepoint.b - self.b), 2)), 1/2)
def __eq__(self, autrepoint):
return self.a == autrepoint.a and self.b == autrepoint.b
class Domino:
def __init__(self, faceA, faceB):
self.a = faceA
self.b = faceB
def __str__(self):
return f"({self.a}, {self.b})"
def valeur(self):
return self.a + self.b
def somme(self, autredomino):
return self.valeur() + autredomino.valeur()
def __eq__(self, autredomino):
return self.valeur() == autredomino.valeur()