Encoding an URL in brainfuck Inspired by this question, your goal today is to encode an URL in brainfuck.

My browser has been hacked! The location bar has been turned into a brainfuck interpreter. I need a program that turns an URL into a brainfuck program. My computer is also very slow, so if the brainfuck program is small it's better.

Oh and I only have one working tab left open, my twitter. So you can only send me the program in a tweet.




Write a program that fits in a tweet (140 characters) in any language that takes a string as input and outputs a brainfuck program.
This brainfuck program will be run without input and will generate an output.
This output will be inserted into the location bar of Google Chrome, and executed.
If the behaviour of Google Chrome is identical to the behaviour you would get by entering the input string from #1, then the solution is valid. Redirection by URL shorteners is considered different behaviour - stay at least on the same domain.


You may assume the brainfuck interpreter has infinite precision signed integers in each cell and an unlimited amount of cells.

Your score is determined by the sum of the lengths of the brainfuck programs generated to encode the following set of URLs:

https://www.google.com/
https://codegolf.stackexchange.com/questions/47895/
http://www.golfscript.com/golfscript/examples.html
http://en.wikipedia.org/wiki/Percent-encoding
ftp://ftp.freebsd.org/pub/FreeBSD/
https://github.com/isaacg1/pyth/blob/master/doc.txt#L92
http://ftp.gnu.org/non-gnu/nethack/nethack-3.4.0.tar.gz.back-RSN.README


Smallest score wins.
Pyth - 118 bytes, score: 154 + 567 + 597 + 620 + 530 + 875 + 1092 = 6630 6623 4653 4435
Now using the factor multiplication algo!
This is a pretty simple algorithm, although slightly better than the above ones. I was planning to use Pyth, but with the current algorithm Python fits&lt;140 bytes.
=zecz&quot;//&quot;=z?&gt;z4}&quot;www.&quot;zz=z?Pzqez\/zFNzKCNJ/^K.5 1=d\+pk+holN[?*-KZd&gt;KZ*-ZK\-+\&gt;*dK+++++\&gt;*Jd&quot;[&gt;&quot;*Jd&quot;&lt;-]&gt;&quot;*-K*JJd)\.=ZK

It first strips out the http:// by using split(&quot;//&quot;) and the www. and / at the end. Then it uses the min function to check which is the best of the the three options that is considered:

Use + or - to update current cell value to desired cell value
Go to new cell and just fill with +'s
Go to new cell and use multiplication to update by doing sqrt(n)*sqrt(n)+remainder since square has minimum perimeter of constant area. http://cydathria.com/bf/bf_ex3.html

I then always put a . to output each char.
A detailed explanation of the new code is coming soon. I kind of half-assed the golfing, especially the stripping of www. and the / at the end but I can't be bothered since I'm 20 bytes under the limit.
This surprisingly works on the ftp:// urls since this is chrome and chrome automatically makes ftp.freebsd.org/pub/FreeBSD/ into ftp://ftp.freebsd.org/pub/FreeBSD/
I plan to next use a dictionary to store the cell values and see if the character was already made in a cell.

Brainfuck Omnibox Extension
That's right! After I saw @BrainSteel's comment, I knew I had to make it. This doesn't take over the entire omnibox, only when you do bf,tab. Also since the omnibox api is weird, it doesn't let me forward the code to the omnibox, I have to handle it myself. So I do my own http:// checking and then set the tab's url.
Since I didn't feel like paying the $5 necessary to put your extension on the webstore, you guys will have to install it manually. Just download the zip from here: https://drive.google.com/file/d/0B0qkKIzGc0QiNzBzVUJjZkRIZ0k/view?usp=sharing, unzip, go into the extensions page in chrome, click dev mode option box on top-right, and load the unpacked extension.
Hope you guys enjoy! :)