Kragen's fifth C .signature puzzle

Last updated 1999-07-12.

Here's the program:

char b[2000],m[]={1,-80,-1,80};main(){int i,x=1000,s=2000,d=0;while(1+(i=
getchar()))switch(i){case'f':b[x]=1;case'g':x=(x+m[d/2]+s)%s;d--;case'+':d+=2;
case'-':d+=7;d%=8;}for(i=0;i!=s;i++)putchar(" #"[b[i]]);}

Here I have a line-by-line explanation and how to run it. It does some cool effects with another tiny program.

It should run perfectly and without crashing in any environment implementing ANSI C. However, for its output to make any kind of sense, it needs someplace to send its output that is 80 columns wide and does automatic wraparound.


Kragen's home page