2021-08-17 15:37:28 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2021-08-10 01:26:35 +00:00
|
|
|
|
2021-08-17 15:37:28 +00:00
|
|
|
class Grid(tuple[int, int]):
|
|
|
|
def __mul__(self, other: Grid) -> Grid:
|
|
|
|
return Grid((self.x * other.x, self.y * other.y))
|
2021-08-09 12:03:45 +00:00
|
|
|
|
|
|
|
@property
|
2021-09-03 05:34:12 +00:00
|
|
|
def x(self) -> int:
|
2021-08-09 12:03:45 +00:00
|
|
|
return self[0]
|
|
|
|
|
|
|
|
@property
|
2021-09-03 05:34:12 +00:00
|
|
|
def y(self) -> int:
|
2021-08-09 12:03:45 +00:00
|
|
|
return self[1]
|
|
|
|
|
|
|
|
@property
|
2021-09-03 05:34:12 +00:00
|
|
|
def capacity(self) -> int:
|
2021-08-09 12:03:45 +00:00
|
|
|
# capacity of grid (reserve last space for card back)
|
|
|
|
return self.x * self.y - 1
|