annotate bin/rainbow.old @ 11951:f96359542199 draft

<ais523> ` printf \'#include <stdio.h>\\nint main(void) { float C = 4.0; printf("%%f", C/C++); }\' | gcc -fno-diagnostics-color -Wall -Wextra -x c /dev/stdin
author HackEso <hackeso@esolangs.org>
date Thu, 19 Sep 2019 17:56:36 +0000
parents c989a1669243
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9075
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
1 #!/hackenv/bin/shebang_args_or_input python
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
2 import random
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
3 import re
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
4 w=raw_input()
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
5 p=list('x'*len(w)+'C'*int((341-len(w))/3+1))
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
6 random.shuffle(p)
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
7 p=list(re.sub('C+','C',''.join(p)))
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
8 i=(c for c in w)
c989a1669243 <fizzie> revert 58b9ee8f97a7
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)