annotate bin/rainbow @ 7946:8ecffca9813d

<moon__> mkx bin/hfs//erro \'You have discovered an eerie cavern. The air aboe the dark stone floor is alive ith vortices of purple light and dark, boiling clouds. Seemingly bottemless pits mark the surface. "$1" stand below\'
author HackBot
date Sat, 07 May 2016 18:36:18 +0000
parents c133bdd56874
children 72e6c7099969
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2475
c133bdd56874 <shachaf> mv bin/{colourise,rainbow}
HackBot
parents:
diff changeset
1 #!/usr/bin/env python
c133bdd56874 <shachaf> mv bin/{colourise,rainbow}
HackBot
parents:
diff changeset
2 import random
c133bdd56874 <shachaf> mv bin/{colourise,rainbow}
HackBot
parents:
diff changeset
3 import re
c133bdd56874 <shachaf> mv bin/{colourise,rainbow}
HackBot
parents:
diff changeset
4 w=raw_input()
c133bdd56874 <shachaf> mv bin/{colourise,rainbow}
HackBot
parents:
diff changeset
5 p=list('x'*len(w)+'C'*int((341-len(w))/3+1))
c133bdd56874 <shachaf> mv bin/{colourise,rainbow}
HackBot
parents:
diff changeset
6 random.shuffle(p)
c133bdd56874 <shachaf> mv bin/{colourise,rainbow}
HackBot
parents:
diff changeset
7 p=list(re.sub('C+','C',''.join(p)))
c133bdd56874 <shachaf> mv bin/{colourise,rainbow}
HackBot
parents:
diff changeset
8 i=(c for c in w)
c133bdd56874 <shachaf> mv bin/{colourise,rainbow}
HackBot
parents:
diff changeset
9 print ''.join(i.next() if c=='x' else chr(3)+'%02d' % random.randrange(2,15) for c in ['C']+p)