diff --git a/src/py2048/utils.py b/src/py2048/utils.py old mode 100644 new mode 100755 index 6b085cb..1c50cd4 --- a/src/py2048/utils.py +++ b/src/py2048/utils.py @@ -6,3 +6,11 @@ class Direction(Enum): DOWN = (0, 1) LEFT = (-1, 0) RIGHT = (1, 0) + + def __mul__(self, num: int) -> tuple[int, int]: + """Multiply the direction by a constant.""" + return self.value[0] * num, self.value[1] * num + + def __imul__(self, num: int) -> tuple[int, int]: + """Multiply the direction by a constant.""" + return self.value[0] * num, self.value[1] * num