def rotated(self, rotation=None, tetromino=None): if rotation is None: rotation = self.tetromino_rotation if tetromino == None: return rotate(self.current_tetromino.shape, rotation) else: return rotate(tetromino.shape, rotation)
def rotated(self, rotation=None): """ Rotates tetromino """ if rotation is None: rotation = self.tetromino_rotation return rotate(self.current_tetromino.shape, rotation)
def get_piece_arrays(tetromino): arr = [] for i in range(4): current = [] for j in range(len(tetromino)): for k in range(len(tetromino[j])): if tetromino[j][k] == "X": current.append([j, k]) for j in range(len(current)): y, x = current[j] cpy = deepcopy(current) for k in range(len(cpy)): cpy[k][0] -= y cpy[k][1] -= x arr.append(cpy) tetromino = rotate(tetromino) return arr