coord rotate
This commit is contained in:
parent
6135e24eac
commit
578b126b3e
@ -262,7 +262,7 @@ class TetrisLogic:
|
|||||||
|
|
||||||
def rotate(self, spin):
|
def rotate(self, spin):
|
||||||
rotated_coords = tuple(
|
rotated_coords = tuple(
|
||||||
Coord(spin * mino.coord.y, -spin * mino.coord.x)
|
mino.coord.rotate(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(
|
||||||
|
@ -7,6 +7,9 @@ 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):
|
||||||
|
return Coord(spin * self.y, -spin * self.x)
|
||||||
|
|
||||||
|
|
||||||
class Movement:
|
class Movement:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user