mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
33 lines
725 B
Python
33 lines
725 B
Python
from typing import NamedTuple, Union
|
|
|
|
|
|
class Size(NamedTuple):
|
|
"""
|
|
A size object.
|
|
|
|
Attributes:
|
|
width: The width of the object.
|
|
height: The height of the object.
|
|
"""
|
|
|
|
width: int | float
|
|
height: int | float
|
|
|
|
def __sub__(self, other: Union["Size", int, float]) -> "Size":
|
|
if isinstance(other, Size):
|
|
return Size(self.width - other.width, self.height - other.height)
|
|
return Size(self.width - other, self.height - other)
|
|
|
|
|
|
class BestMove(NamedTuple):
|
|
"""
|
|
A best move object.
|
|
|
|
Attributes:
|
|
rotation: The rotation of the best move.
|
|
x_axis_offset: The x-axis offset of the best move.
|
|
"""
|
|
|
|
rotation: int
|
|
x_axis_offset: int
|