Example #1
0
    def get_possible_moves(self, board: 'Board', turn: int) -> set:
        position = self.get_position()
        moves = piece_utils.line_of_sight_moves(board, position, self.__directions, 1)

        board.set_is_simulation(True)
        board.remove_piece_at(position)
        color = self.get_color()
        moves = set(filter(lambda x: not board.is_tile_attacked(color, x, turn), moves))
        board.set_piece_at(position, self)
        board.set_is_simulation(False)

        return set(moves)
Example #2
0
 def get_possible_moves(self, board: 'Board', turn: int) -> set:
     return piece_utils.line_of_sight_moves(board, self.get_position(),
                                            self.__directions)
Example #3
0
 def get_possible_moves(self, board: 'Board', turn: int) -> set:
     moves = piece_utils.line_of_sight_moves(board, self.get_position(),
                                             self.__directions)
     moves = moves.union(self.__right_castling(board, turn))
     moves = moves.union(self.__left_castling(board, turn))
     return moves