AdventOfCode/2021/Day5/Line.py
2022-12-09 08:29:06 +01:00

26 lines
496 B
Python

class Point:
x: int
y: int
def __init__(self, x, y):
self.x = x
self.y = y
class Line:
start: Point
end: Point
axis: str
def __init__(self, x1, y1, x2, y2):
self.start = Point(x1, y1)
self.end = Point(x2, y2)
if x1 == x2:
self.axis = "X"
elif y1 == y2:
self.axis = "Y"
elif abs(x1 - x2) == abs(y1 - y2):
self.axis = "DIAG"
else:
self.axis = "INVALID"