This commit is contained in:
adrienmalin
2019-10-02 00:57:19 +02:00
parent b8e20199af
commit dda475a584
6 changed files with 164 additions and 172 deletions

View File

@ -1,15 +1,14 @@
# -*- coding: utf-8 -*-
from .utils import Coord, Rotation
class Mino:
class Mino:
def __init__(self, color, coord):
self.color = color
self.coord = coord
class MetaTetromino(type):
def __init__(cls, name, bases, dct):
super().__init__(name, bases, dct)
Tetromino.shapes.append(cls)
@ -35,10 +34,7 @@ class Tetromino(list):
}
def __init__(self):
super().__init__(
Mino(self.MINOES_COLOR, coord)
for coord in self.MINOES_COORDS
)
super().__init__(Mino(self.MINOES_COLOR, coord) for coord in self.MINOES_COORDS)
self.orientation = 0
self.last_rotation_point = None
self.hold_enabled = True
@ -47,6 +43,7 @@ class Tetromino(list):
def ghost(self):
return type(self)()
class O(Tetromino, metaclass=MetaTetromino):
SRS = {
@ -107,4 +104,4 @@ class S(Tetromino, metaclass=MetaTetromino):
class Z(Tetromino, metaclass=MetaTetromino):
MINOES_COORDS = (Coord(-1, 1), Coord(0, 1), Coord(0, 0), Coord(1, 0))
MINOES_COLOR = "red"
MINOES_COLOR = "red"