From b8e4d2471aaefa5ba1fb8304a2d2ce5cb6c11024 Mon Sep 17 00:00:00 2001 From: adrienmalin <41926238+adrienmalin@users.noreply.github.com> Date: Fri, 30 Nov 2018 19:54:06 +0100 Subject: [PATCH] T_SLOT --- src/main/python/tetromino.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/python/tetromino.py b/src/main/python/tetromino.py index 4ac054e..f90742f 100644 --- a/src/main/python/tetromino.py +++ b/src/main/python/tetromino.py @@ -191,10 +191,13 @@ class TetroT(Tetromino, metaclass=MetaTetro): """ COORDS = (0, 0), (L, 0), (0, U), (R, 0) - T_SLOT_A = ((L, U), (R, U), (R, D), (L, D)) - T_SLOT_B = ((R, U), (R, D), (L, D), (L, U)) - T_SLOT_C = ((L, D), (L, U), (R, U), (R, D)) - T_SLOT_D = ((R, D), (L, D), (L, U), (R, U)) + + T_SLOT = ( + ((L, U), (R, U), (L, D), (R, D)), + ((R, U), (R, D), (L, U), (L, D)), + ((R, D), (L, D), (R, U), (L, U)), + ((L, D), (L, U), (R, D), (R, U)), + ) def __init__(self): super().__init__() @@ -211,10 +214,10 @@ class TetroT(Tetromino, metaclass=MetaTetro): rotated = super().rotate(direction) if rotated: center = self.minoes[0].coord - pa = center + Point(*self.T_SLOT_A[self.orientation]) - pb = center + Point(*self.T_SLOT_B[self.orientation]) - pc = center + Point(*self.T_SLOT_C[self.orientation]) - pd = center + Point(*self.T_SLOT_D[self.orientation]) + pa = center + Point(*self.T_SLOT[self.orientation][0]) + pb = center + Point(*self.T_SLOT[self.orientation][1]) + pc = center + Point(*self.T_SLOT[self.orientation][2]) + pd = center + Point(*self.T_SLOT[self.orientation][3]) a = not self.matrix.is_empty_cell(pa) b = not self.matrix.is_empty_cell(pb)