From f4049ca3bbd79c2c6568e519cde92836cc79769a Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sat, 13 Nov 2021 12:05:18 +0100 Subject: Add optional coordinates to a piece Signed-off-by: Olivier Gayot --- cameltris/coordinates.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 cameltris/coordinates.py (limited to 'cameltris/coordinates.py') diff --git a/cameltris/coordinates.py b/cameltris/coordinates.py new file mode 100644 index 0000000..a5cee80 --- /dev/null +++ b/cameltris/coordinates.py @@ -0,0 +1,11 @@ +from dataclasses import dataclass + + +@dataclass +class Coordinates: + x: int + y: int + + def __add__(self, other: "Coordinates"): + """ Return the result of the addition of two Coordinates objects. """ + return Coordinates(x=self.x + other.x, y = self.y + other.y) -- cgit v1.2.3