P
Paul McGuire
Here is some semi-obfuscated Python, to generate rotational
palindromes:
from random import choice
base = "sznuoxpqbdMWOINZXSH"
rot = dict(zip(base,"szunoxdbqpWMOINZXSH"))
for i in range(40):
s1 = [choice(base) for j in range(choice((2,3,4)))]
start = (1,2)[rot[s1[-1]]==s1[-1] and choice((True,False))]
s2 = [rot[c] for c in s1[-start::-1]]
print "".join(s1+s2)
Enjoy!
-- Paul
palindromes:
from random import choice
base = "sznuoxpqbdMWOINZXSH"
rot = dict(zip(base,"szunoxdbqpWMOINZXSH"))
for i in range(40):
s1 = [choice(base) for j in range(choice((2,3,4)))]
start = (1,2)[rot[s1[-1]]==s1[-1] and choice((True,False))]
s2 = [rot[c] for c in s1[-start::-1]]
print "".join(s1+s2)
Enjoy!
-- Paul