Skip to content

Instantly share code, notes, and snippets.

@d0ugal
Created August 31, 2012 11:38
Show Gist options
  • Save d0ugal/3551741 to your computer and use it in GitHub Desktop.
Save d0ugal/3551741 to your computer and use it in GitHub Desktop.
s,z,Z,L,X=" ","%s",zip,len,xrange;print"\n".join(x.rstrip()for x in(lambda y:y[0](y,5,1))([lambda y,n,w:[s*w for _ in X(1,w)]+["__"*w]if n==0 else[z*3%(s*(L(t)//2),t,s*(L(t)//2))for t in y[0](y,n-1,w)]+[z*2%m for m in Z(y[1](y,n-1,w),y[2](y,n-1,w))],lambda y,n,w:[(s*i)+"/"+(s*j)for(i,j)in Z(X(w-1,-1,-1),X(w,w*2))]if n==0 else[z*3%(s*(L(t)//2),t,s*(L(t)//2))for t in y[2](y,n-1,w)]+[z*2%m for m in Z(y[0](y,n-1,w),y[1](y,n-1,w))],lambda y,n,w:[(s*i)+"\\"+(s*j)for(j,i)in Z(X(w-1,-1,-1),X(w,w*2))]if n==0 else[z*3%(" "*(L(t)//2),t," "*(L(t)//2)) for t in y[1](y,n-1,w)]+ [z*2%m for m in Z(y[2](y,n-1,w),y[0](y,n-1,w))]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment