Skip to content

Instantly share code, notes, and snippets.

@Eckankar
Created June 7, 2010 17:14
Show Gist options
  • Save Eckankar/428932 to your computer and use it in GitHub Desktop.
Save Eckankar/428932 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
from __future__ import print_function
from sys import argv
from math import sqrt, floor
text = " ".join(argv[1:])
def p(*args):
print(*args, sep='', end='')
p(' [-]>')
if len(text) > 0:
p('[-]','\n')
for ch in text:
ch = ord(ch)
if ch > 16:
s = int(round(sqrt(ch)))
d = ch-s*s
sgn = d > 0 and '+' or '-'
if d < 0:
d = -d
p('>[-]', s * '+', '[-<', s * '+', '>]')
if d != 0:
p('<', d*sgn, '>')
else:
p(ch*'+', '>')
p('\n')
p('<[<]>', '[.>]', '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment