Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Python: String to Brainfuck
#python 3.5.2 def cdc(i): t = i % 10 if t > 5: i += 10 return i - t def StrToBrf(v): s = 10 * '+' + '[' t = "" for i in range(len(v)): i_ord = ord(v[i]) i_cdc = cdc(ord(v[i])) i_max = 256 - i_ord s += '>' + ('-' * i_max if (i_max < 128) else '+' * (i_cdc // 10)) t += '>' + ('+' if (i_ord - i_cdc > 0) else '-') * abs(i_ord - i_cdc) s += '<' * len(v) + '-]' + t + (len(v) - 1) * '<' + '[.>]' return s print(StrToBrf('String to Brainfuck'))
run
|
edit
|
history
|
help
0
abracadabra
Variables.py
8
DICTIONARY PROBLEM
Code1
self
library
Hello World Test
Circular progress bar tkinter
Insert a sequence of same numbers, unpacking