Everyonce in a while I'll decide to put down my RPG for an hour and program something completely pointless. I'll post all that I do during those periods, here:
MSN ASCII GENERATOR
def display(x,y):
print
for a in range(len(x)):
for b in range(len(x[a])):
if x[a][b]==" ":y.append(blank)
elif x[a][b]=="#":y.append(fill)
print"".join(y);y=[]
print
a=raw_input("Load or Draw Your Design? (L/D) ")
if a=="D" or a=="d":
display(x,[]);a=raw_input("Save? (Y/N) ")
if a=="Y" or a=="y":print;b=input("Save Slot? ");the_file=open("designs_"+str(b),'w');the_text="("+str(b)+") "+str(x);the_file.write(the_text)
else:
print;b=input("Load Slot Number? ");the_file=open("designs_"+str(b),'r');the_contents=the_file.read();r=[]
for c in range(len(the_contents)):
if the_contents[c:c+len(str(b))]==str(b):r.append(c)
elif the_contents[c:c+len(str(b))]==int:r.append(c)
if len(r)==1:r.append(len(the_contents));x=[];f=[]
for a in range(len(the_contents[r[0]+4+len(str(b)):r[1]-2])):
if the_contents[r[0]+4+len(str(b))+a]=="'":f.append(a)
x.append(the_contents[r[0]+4+len(str(b)):r[0]+4+len(str(b))+f[0]])
for a in range(1,len(f)):
if a%2==0:x.append(the_contents[r[0]+5+len(str(b))+f[a-1]:r[0]+4+len(str(b))+f[a]])
x.append(the_contents[r[0]+5+len(str(b))+f[len(f)-1]:r[1]-2])
if r!=[]:display(x,[])
That was actually pretty hard and complicated to make. Lots of trial and error. And lots of unecessary listing (my style of doing things).
How to run the program:
###########################################################################
#DRAW ASCII HERE
x = [
' ######## ',
'##########',
'### ## ###',
'##########',
' ### ### ',
' ## ## ',
' ###### ',
]
#REPLACE WITH EMOTIONS OF YOUR CHOICE
blank = "<>"
fill = "(@)"
###########################################################################
The output of the program would be:
<>(@)(@)(@)(@)(@)(@)(@)(@)<>
(@)(@)(@)(@)(@)(@)(@)(@)(@)(@)
(@)(@)(@)<>(@)(@)<>(@)(@)(@)
(@)(@)(@)(@)(@)(@)(@)(@)(@)(@)
<>(@)(@)(@)<><>(@)(@)(@)<>
<><>(@)(@)<><>(@)(@)<><>
<><>(@)(@)(@)(@)(@)(@)<><>
Which can then be copy pasted into MSN to make a skull (if you have <> set to a custom blank box emotion). You could easily modify this program to make tons of really cool pictures with your own emotions.
The reason the program is bigger then it would really be, is because you can save and load all your designs from the Shell (practically to an infinite extent!).
More pointless stuff to come.
