box aligning language by rolf

s=raw_input()
R=range
k=0
q=[]
def C(a,v,u):
 y=len(a);x=len(a[0]) 
 for j in R(y):
  for i in R(x):f[j+v][i+u]=a[j][i] 
while k<len(s):
 if s[k]in"-|":
  z=s[k]=="-";b=q.pop();a=q.pop();f=[["." for i in R(len(a[0])+len(b[0])if z else max(len(a[0]),len(b[0])))]for j in R(max(len(a),len(b))if z else len(a)+len(b))];C(a,0,0);C(b,len(a)*(1-z),len(a[0])*z) 
 else:
  h=int(s[k]);k+=1;v=int(s[k]);k+=1;c=s[k];f=[[c for i in R(h)] for j in R(v)]
 k+=1;q+=[f]
for q in f: print "".join(q)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive)

download

return to the top page