def valid_moves(self): possibles = self.possibles() would_be_checker = Piece.blocking_check_against(self) if would_be_checker: return [] else: return possibles
def valid_moves(self): would_be_checker = Piece.blocking_check_against(self) if would_be_checker: if would_be_checker.pos in self.possibles(): return [would_be_checker.pos] else: return [] i, j = self.pos forward_one = [self.operator1(i, 1), j] forward_two = [self.operator1(i, 2), j] forward_left, forward_right = self.taking_positions() return self.filter_valids(forward_one, forward_two, forward_left, forward_right)