Last active
March 4, 2016 02:21
-
-
Save nasamuffin/64fb4f05d436d4cc5f6b to your computer and use it in GitHub Desktop.
WEWLAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import string | |
import unicodedata | |
def pad(width): | |
return uni(" ") * width | |
def uni(stringy): | |
ascii_to_wide = dict((i, unichr(i + 0xfee0)) for i in range(0x21, 0x7f)) | |
ascii_to_wide.update({0x20: u'\u3000', 0x2D: u'\u2212'}) # space and minus | |
return unicode(stringy, "unicode-escape").translate(ascii_to_wide) | |
def square(inp): | |
backwards = inp[::-1] | |
print inp | |
for i in range(1, len(inp)-1): | |
print inp[i] + pad(len(inp)-2) + backwards[i] | |
print backwards | |
def star_even(inp): | |
backwards = inp[::-1] | |
half = len(inp)/2 | |
for i in range(0, half): | |
print pad(i) + inp[i] + pad(2*(half-i-1)) + backwards[i] | |
for i in range(0, half): | |
print pad(half-i-1) + backwards[half+i] + pad(2*i) + inp[half+i] | |
def star_odd(inp): | |
backwards = inp[::-1] | |
half = len(inp)/2 | |
for i in range(0, half): | |
print pad(i) + inp[i] + pad(half-i-1) + inp[i] + pad(half-i-1) + backwards[i] | |
print inp | |
for i in range(0, half): | |
print pad(half-i-1) + backwards[half+i+1] + pad(i) + inp[half+i+1] + pad(i) + inp[half+i+1] | |
def star(inp): | |
if len(inp)%2: | |
star_odd(inp) | |
else: | |
star_even(inp) | |
def rotation(inp): | |
backwards = inp[::-1] | |
print inp + inp[0] | |
for i in range(1, len(inp)): | |
print backwards[i-1 % len(inp)] + pad(len(inp)-1) + inp[i] | |
print inp[0] + backwards | |
def main(argv=None): | |
if not argv: argv = sys.argv | |
# Convert it to uppercase, no spaces | |
desired_aesthetic = argv[1] | |
aesthetic = uni("".join(argv[2:]).upper()) | |
globals()[desired_aesthetic](aesthetic) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment