#include /* draw a 31x31 ASCII of a Hibert Curve - JDM 2004.06.05 */ char m[31][31];int a[2];void s(unsigned d){m[a[1]][a[0]]='#';a[d&1]+=1-(d&2);} void h(int o,int r,unsigned d){if(o--){d+=r;h(o,-r,d);s(d);s(d);d-=r;h(o,r,d); s(d);s(d);h(o,r,d);d-=r;s(d);s(d);h(o,-r,d);}}int main(){int i;for(i=961;i;)m[ 0][--i]=' ';h(4,1,0);s(0);for(i=0;i<31;i++)printf("%.*s\n",31,m[i]);return 0;}