コード例 #1
0
 def get_possible_captures(self, board: Board, turn: int) -> set:
     captures = piece_utils.line_of_sight_captures(board, self,
                                                   self.__captures, 1)
     x, y = self.get_position()
     left = x - 1, y
     if self.__can_be_captured_en_passant(board, left, turn):
         captures.add(board.get_piece_at(left).get())
     right = x + 1, y
     if self.__can_be_captured_en_passant(board, right, turn):
         captures.add(board.get_piece_at(right).get())
     return captures
コード例 #2
0
 def get_possible_captures(self, board: Board, turn: int) -> set:
     return piece_utils.line_of_sight_captures(board, self,
                                               self.__directions)
コード例 #3
0
ファイル: king.py プロジェクト: willGuimont/chess
 def get_possible_captures(self, board: Board, turn: int) -> set:
     captures = piece_utils.line_of_sight_captures(board, self, self.__directions, 1)
     captures = set(filter(lambda x: self.__can_capture_there(board, x, turn), captures))
     return set(captures)