             throw ExecutionError.illegalMove(move, playerTurn, board)
         }
         try execute(uncheckedMove: move, promotion: promotion)
-        if kingIsChecked {
-            attackersToKing = 0
-        } else {
-            attackersToKing = board.attackersToKing(for: playerTurn)
-        }
-        _undoHistory = []
     }
 
     /// Executes `move`, updating the state for `self`.

        return Bitboard(square: move.end).intersects(moves)
    }

    /// Executes `move` without checking its legality, updating the state for `self`.
    ///
    /// - warning: Can cause unwanted effects. Should only be used with moves that are known to be legal.
    ///
    /// - parameter move: The move to be executed.
    /// - parameter promotion: A closure returning a promotion piece kind if a pawn promotion occurs.
    ///
    /// - throws: `ExecutionError` if no piece exists at `move.start` or if `promotion` is invalid.
    public func execute(uncheckedMove move: Move, promotion: @noescape () -> Piece.Kind) throws {
        guard let piece = board[move.start] else {
            throw ExecutionError.missingPiece(move.start)
        }

        playerTurn.invert()
    }

    /// Executes `move` without checking its legality, updating the state for `self`.
    ///
    /// - warning: Can cause unwanted effects. Should only be used with moves that are known to be legal.
    ///
    /// - parameter move: The move to be executed.
    /// - parameter promotion: A closure returning a promotion piece kind if a pawn promotion occurs.
    ///
    /// - throws: `ExecutionError` if no piece exists at `move.start` or if `promotion` is invalid.
    public func execute(uncheckedMove move: Move, promotion: @noescape () -> Piece.Kind) throws {
        try _execute(uncheckedMove: move, promotion: promotion)
        if kingIsChecked {
            attackersToKing = 0
        } else {
            attackersToKing = board.attackersToKing(for: playerTurn)
        }
        _undoHistory = []
    }

    #else

    /// Returns `true` if the move is legal.
