Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## WELCOME TO TAXI'S SHITTY CODING!!! now with 100% more useless comments!
- ## 4chan's char limit is 27!
- import sys
- path = sys.argv[1:] ## this reads the path from the terminal
- def doit(path): ## this is the function that will be called at the end of the program
- block2 = (" ", "=", "¯", "_", "*", "|") ## these are old blocks i used for testing
- blocks = ("░", "█", "▀", "▄", "*", "|") ## these are the actual blocks that behave oddly in IDLE
- parts = ([0,0,0], [3,2,3], [1,2,3], [3,2,2], [1,2,2], [1,0,1], [2,1,2], [0,0,1], [1,2,1], [1,0,0], [1,2,0], [0,1,0], [3,0,1], [2,0,2], [2,2,0], [0,2,2], [2,2,2], [2,0,0], [2,2,1], [0,2,0], [0,2,3], [3,2,0], [0,3,3], [0,0,2], [3,2,1], [2,3,1], [0,3,2], [2,3,2], [2,1,0], [3,3,0], [0,3,0], [1,0,2], [0,2,1], [3,1,3], [3,0,3], [3,3,3], [3,0,0], [0,0,3], [1,3,2], [3,1,0], [2,2,3], [-2], [0,2,0,2,0], [3,0,3,0,3], [2,0,2,0,2], [1,0,1,0,1], [3,3,0,3,0], [2,0,0,2], [1,0,2,1], [1,3,0,1], [2,0,0,0,2], [1,0,2,0,1], [1,3,0,3,1], [-1])
- letters = {"a":[20,24,15], "b":[9,2,14], "c":[22,9,15], "d":[7,24,15], "e":[1,4,15], "f":[26,6,19], "g":[1,25,26], "h":[9,2,13], "i":[19,28,16], "j":[23,7,27], "k":[9,38,13], "l":[28,11,16], "m":[-8,-9,-10], "n":[29,5,13], "o":[30,5,19], "p":[29,5,10], "q":[30,31,14], "r":[30,31,17], "s":[3,20,14], "t":[33,11,20], "u":[34,5,16], "v":[34,5,19], "w":[-11,-9,-12], "x":[34,11,13], "y":[34,25,26], "z":[35,26,16], "A":[1,8,13], "B":[2,2,14], "C":[3,9,15], "D":[2,5,14], "E":[4,10,16], "F":[4,10,17], "G":[3,5,15], "H":[5,8,13], "I":[6,11,16], "J":[7,12,16], "K":[5,2,13], "L":[9,9,16], "M":[-2,-3,-4], "N":[-5,-6,-7], "O":[1,5,19], "P":[2,10,17], "Q":[1,5,20], "R":[2,2,13], "S":[3,18,14], "T":[6,11,19], "U":[5,5,16], "V":[5,5,19], "W":[-9,-9,-12], "X":[5,1,13], "Y":[5,11,19], "Z":[18,21,16], " ":[0,0,0], "?":[1,26,30], "!":[11,19,19], "/":[7,11,9], "-":[0,16,0], "_":[0,0,35], "+":[30,6,0], ":":[30,30,0], ">":[36,20,21], "<":[37,21,20], ".":[0,0,19], "1":[39,11,16], "2":[1,26,16], "3":[40,20,14], "4":[24,18,23], "5":[4,40,14], "6":[21,2,19], "7":[18,21,17], "8":[1,1,19], "9":[1,32,19], "0":[1,8,19]}
- list1 = [] ## these three lists are the lines of the final document.
- list2 = [] ## the following code will paste blocks in a certain order in each of these lists
- list3 = []
- infile = open(str(path[0]), "r")
- string = infile.read() ## this stuff defines what to read and where to write (the same place)
- outfile = open(str(path[0]), "w")
- for char in str(string):
- if char in letters.keys(): ## i don't remember what "letters.keys()" means, but what this does is:
- indexes = letters[char] ## "if the characters is in the list "letters", then paste its parts into each list.
- list1 += parts[indexes[0]] + [0] ## ...also add a little space between each letter."
- list2 += parts[indexes[1]] + [0]
- list3 += parts[indexes[2]] + [0]
- continue
- elif char == "\n":
- list1 += parts[-13]
- list2 += parts[-13] ## if the character is a new line, this pastes a "-2" into the line. (it reads -13 because "-2" is saved in parts as the -13th number, duh!)
- list3 += parts[-13] ## the -2 will later be converted into a new line, but on three lines..!
- continue
- else:
- list1 += parts[-1] ## if the character is not in the list above or a new line, the character | will be added to all the lists.
- list2 += parts[-1] ## this is so you know which character is missing and stuff! If you want you can even add the missing character
- list3 += parts[-1] ## so that this won't happen anymore!
- masterlist = list1 + [-2] + list2 + [-2] + list3 ## okay here it gets complicated
- uberlist = [[]] ## what even is this shit?!
- for index in masterlist:
- if index == -2:
- uberlist += [[]] ## oooh yeah! this is some sort of odd lists system that allowed me to print.
- ## too bad i remember jackshit on how it works!
- words = len(uberlist) / 3 ## this must be something important
- index = 0
- for item in masterlist:
- if item != -2:
- uberlist[index] += [item]
- continue ## okay i am completely lost
- index += 1
- index = 0
- line = blocks[0]
- wordswritten = 0
- for item in uberlist: ## no way i'm going to try and understand that
- for item in uberlist[index]:
- line += blocks[item]
- outfile.write(line + "\n")
- if index < len(uberlist) - words:
- index += words
- line = blocks[0]
- continue
- else:
- outfile.write(blocks[0] * (len(uberlist[index])+1) + "\n")
- line = blocks[0]
- wordswritten += 1
- index = 0 + wordswritten
- outfile.close()
- doit(path) ## this shit here executes everything! Always remember to call back the function when you, uhh... use a function!!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement