Finds if playing my move would make both kings meet.

        :type: pos: Board
        :type: move: Move
        :rtype: bool
334242
def in_check_as_result(self, pos, move):
        
        test = cp(pos)
        test.update(move)
        test_king = test.get_king(move.color)

        return self.loc_adjacent_to_opponent_king(test_king.location, test)
439792
def check_collision(self, other):
        """"""
        other = Network(other)
        return self.network_long() <= other.network_long() <= self.broadcast_long() or \
            other.network_long() <= self.network_long() <= other.broadcast_long()
1346906
def accept(self, visitor: "BaseVisitor[ResultT]", *, _parent_board: Optional[chess.Board] = None) -> ResultT:
        
        board = self.parent.board() if _parent_board is None else _parent_board

        # First, visit the move that leads to this node.
        self._accept_node(board, visitor)

        # Then visit sidelines.
        if _parent_board is not None and self == self.parent.variations[0]:
            for variation in itertools.islice(self.parent.variations, 1, None):
                if visitor.begin_variation() is not SKIP:
                    variation.accept(visitor, _parent_board=board)
                visitor.end_variation()

        # The mainline is continued last.
        if self.variations:
            board.push(self.move)
            self.variations[0].accept(visitor, _parent_board=board)
            board.pop()

        # Get the result if not called recursively.
        return visitor.result() if _parent_board is None else None
936471
def was_into_check(self) -> bool:
        
        king = self.king(not self.turn)
        return king is not None and self.is_attacked_by(self.turn, king)
1075234
def from_chess960_pos(cls: Type[BaseBoardT], sharnagl: int) -> BaseBoardT:
        
        board = cls.empty()
        board.set_chess960_pos(sharnagl)
        return board
1025622
def intersects(self, e):
    
    if self.chrom != e.chrom:
      return False

    if e.start >= self.start and e.start < self.end:
      return True
    if e.end > self.start and e.end <= self.end:
      return True
    if e.start < self.start and e.end > self.end:
      return True
    return False
1325786
function canMove(game, move) {
    if (!Game.isMyTurn(game, move.from))
        return false;
    const positionsWhereCanIGo = Board.getPositionsWhereCanIGo(game.board, move.from);
    return positionsWhereCanIGo.some(position => Position.hasSameXY(position, move.to));
}
792429
def has_kingside_castling_rights(self, color: Color) -> bool:
        
        backrank = BB_RANK_1 if color == WHITE else BB_RANK_8
        king_mask = self.kings & self.occupied_co[color] & backrank & ~self.promoted
        if not king_mask:
            return False

        castling_rights = self.clean_castling_rights() & backrank
        while castling_rights:
            rook = castling_rights & -castling_rights

            if rook > king_mask:
                return True

            castling_rights = castling_rights & (castling_rights - 1)

        return False
1185679
function hasPositionByBoardSize(boardSize, position) {
    return position && position.x >= 0 && position.y >= 0 && boardSize.y > position.y && boardSize.x > position.x;
}
631051
def do_intersect(bb1, bb2):
    
    if bb1[0] + bb1[2] < bb2[0] or bb2[0] + bb2[2] < bb1[0]:
        return False
    if bb1[1] + bb1[3] < bb2[1] or bb2[1] + bb2[3] < bb1[1]:
        return False
    return True
1260527
def update(self, move):
        
        if move is None:
            raise TypeError("Move cannot be type None")

        if self.king_loc_dict is not None and isinstance(move.piece, King):
            self.king_loc_dict[move.color] = move.end_loc

        # Invalidates en-passant
        for square in self:
            pawn = square
            if isinstance(pawn, Pawn):
                pawn.just_moved_two_steps = False

        # Sets King and Rook has_moved property to True is piece has moved
        if type(move.piece) is King or type(move.piece) is Rook:
            move.piece.has_moved = True

        elif move.status == notation_const.MOVEMENT and \
                isinstance(move.piece, Pawn) and \
                fabs(move.end_loc.rank - move.start_loc.rank) == 2:
            move.piece.just_moved_two_steps = True

        if move.status == notation_const.KING_SIDE_CASTLE:
            self.move_piece(Location(move.end_loc.rank, 7), Location(move.end_loc.rank, 5))
            self.piece_at_square(Location(move.end_loc.rank, 5)).has_moved = True

        elif move.status == notation_const.QUEEN_SIDE_CASTLE:
            self.move_piece(Location(move.end_loc.rank, 0), Location(move.end_loc.rank, 3))
            self.piece_at_square(Location(move.end_loc.rank, 3)).has_moved = True

        elif move.status == notation_const.EN_PASSANT:
            self.remove_piece_at_square(Location(move.start_loc.rank, move.end_loc.file))

        elif move.status == notation_const.PROMOTE or \
                move.status == notation_const.CAPTURE_AND_PROMOTE:
            try:
                self.remove_piece_at_square(move.start_loc)
                self.place_piece_at_square(move.promoted_to_piece(move.color, move.end_loc), move.end_loc)
            except TypeError as e:
                raise ValueError("Promoted to piece cannot be None in Move {}\n{}".format(repr(move), e))
            return

        self.move_piece(move.piece.location, move.end_loc)
1333083
def _is_in_restart(self, x, y):
        """"""
        x1, y1, x2, y2 = self._new_game
        return x1 <= x < x2 and y1 <= y < y2
715318
def clean_castling_rights(self) -> Bitboard:
        
        if self._stack:
            # Castling rights do not change in a game, so we can assume them to
            # be filtered already.
            return self.castling_rights

        castling = self.castling_rights & self.rooks
        white_castling = castling & BB_RANK_1 & self.occupied_co[WHITE]
        black_castling = castling & BB_RANK_8 & self.occupied_co[BLACK]

        if not self.chess960:
            # The rooks must be on a1, h1, a8 or h8.
            white_castling &= (BB_A1 | BB_H1)
            black_castling &= (BB_A8 | BB_H8)

            # The kings must be on e1 or e8.
            if not self.occupied_co[WHITE] & self.kings & ~self.promoted & BB_E1:
                white_castling = 0
            if not self.occupied_co[BLACK] & self.kings & ~self.promoted & BB_E8:
                black_castling = 0

            return white_castling | black_castling
        else:
            # The kings must be on the back rank.
            white_king_mask = self.occupied_co[WHITE] & self.kings & BB_RANK_1 & ~self.promoted
            black_king_mask = self.occupied_co[BLACK] & self.kings & BB_RANK_8 & ~self.promoted
            if not white_king_mask:
                white_castling = 0
            if not black_king_mask:
                black_castling = 0

            # There are only two ways of castling, a-side and h-side, and the
            # king must be between the rooks.
            white_a_side = white_castling & -white_castling
            white_h_side = BB_SQUARES[msb(white_castling)] if white_castling else 0

            if white_a_side and msb(white_a_side) > msb(white_king_mask):
                white_a_side = 0
            if white_h_side and msb(white_h_side) < msb(white_king_mask):
                white_h_side = 0

            black_a_side = (black_castling & -black_castling)
            black_h_side = BB_SQUARES[msb(black_castling)] if black_castling else BB_EMPTY

            if black_a_side and msb(black_a_side) > msb(black_king_mask):
                black_a_side = 0
            if black_h_side and msb(black_h_side) < msb(black_king_mask):
                black_h_side = 0

            # Done.
            return black_a_side | black_h_side | white_a_side | white_h_side
323249
def is_kingside_castling(self, move: Move) -> bool:
        
        return self.is_castling(move) and square_file(move.to_square) > square_file(move.from_square)
758757
def is_seventyfive_moves(self) -> bool:
        
        if self.halfmove_clock >= 150:
            if any(self.generate_legal_moves()):
                return True

        return False
1339493
def is_irreversible(self, move: Move) -> bool:
        
        backrank = BB_RANK_1 if self.turn == WHITE else BB_RANK_8
        cr = self.clean_castling_rights() & backrank
        return bool(self.is_zeroing(move) or
                    cr and BB_SQUARES[move.from_square] & self.kings & ~self.promoted or
                    cr & BB_SQUARES[move.from_square] or
                    cr & BB_SQUARES[move.to_square])
804416
def is_zeroing(self, move: Move) -> bool:
        """"""
        return bool(BB_SQUARES[move.from_square] & self.pawns or BB_SQUARES[move.to_square] & self.occupied_co[not self.turn])