coord rotate

This commit is contained in:
Adrien MALINGREY 2019-10-08 02:01:41 +02:00
parent 6135e24eac
commit 578b126b3e
2 changed files with 4 additions and 1 deletions

View File

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

View File

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