__matmul__

This commit is contained in:
Adrien MALINGREY 2019-10-08 02:29:57 +02:00
parent 578b126b3e
commit fe93336bb9
2 changed files with 2 additions and 2 deletions

View File

@ -262,7 +262,7 @@ class TetrisLogic:
def rotate(self, spin): def rotate(self, spin):
rotated_coords = tuple( rotated_coords = tuple(
mino.coord.rotate(spin) mino.coord @ spin
for mino in self.matrix.piece for mino in self.matrix.piece
) )
for rotation_point, liberty_degree in enumerate( for rotation_point, liberty_degree in enumerate(

View File

@ -7,7 +7,7 @@ class Coord:
def __add__(self, other): def __add__(self, other):
return Coord(self.x + other.x, self.y + other.y) return Coord(self.x + other.x, self.y + other.y)
def rotate(self, spin): def __matmul__(self, spin):
return Coord(spin * self.y, -spin * self.x) return Coord(spin * self.y, -spin * self.x)