Skip to content

Instantly share code, notes, and snippets.

@zarazum
Created October 1, 2013 05:14
Show Gist options
  • Save zarazum/6774139 to your computer and use it in GitHub Desktop.
Save zarazum/6774139 to your computer and use it in GitHub Desktop.
unrle
import re
rle='''43b3o3b3o$42bo2bo3bo2bo$23b4o18bo3bo18b4o$23bo3bo17bo3bo17bo3bo$23bo8b
o12bo3bo12bo8bo$24bo2bo2b2o2bo25bo2b2o2bo2bo$29bo5bo7b3o3b3o7bo5bo$29b
o5bo8bo5bo8bo5bo$29bo5bo8b7o8bo5bo$24bo2bo2b2o2bo2b2o4bo7bo4b2o2bo2b2o
2bo2bo$23bo8bo3b2o4b11o4b2o3bo8bo$23bo3bo9b2o17b2o9bo3bo$23b4o11b19o
11b4o$39bobo11bobo$42b11o$42bo9bo$43b9o$47bo$43b3o3b3o$45bo3bo2$44b3ob
3o$44b3ob3o$43bob2ob2obo$43b3o3b3o$44bo5bo35$3o$2bo$bo!'''
rle='''2$7bo$7bo$7bo$7bo$7bo$6bo5b6o$b11o6bo$6bo$6bo$6bo$6bo$6bo$6bo$6bo!
'''
items=re.findall(r'[0-9]*[bo]|\$',rle)
s=''
for i in items:
if i in 'bo$':
s=s+i
else:
s=s+i[-1]*int(i[0:-1])
s=s.replace('b','.')
s=s.replace('o','X')
s=s.replace('$','\n')
print s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment