How to run Kragen's fourth C .signature puzzle

Last updated 1999-07-12.

This program:

char b[2][10000],*s,*t=b,*d,*e=b+1,**p;main(int c,char**v){int n=atoi(v[1]);
strcpy(b,v[2]);while(n--){for(s=t,d=e;*s;s++){for(p=v+3;*p;p++)if(**p==*s){
strcpy(d,*p+2);d+=strlen(d);goto x;}*d++=*s;x:}s=t;t=e;e=s;*d++=0;}puts(t);}

can be compiled on a Unix system with any C compiler, such as gcc, with a command-line like gcc -Wall junk.c -o puz4. It shouldn't need any special libraries specified. This will produce an executable called 'puz4'.

It should probably compile and run without trouble on just about any environment that supports C, although it does depend on argv being NULL-terminated.

This program needs at least two arguments; the first one is a small integer and the second one is a string. It can have further arguments, too.

Here are some things to try:

./puz4 3 f f=ff
./puz4 3 a a=ab b=ba
./puz4 8 fx f= y=+fx--fy+ x=-fx++fy-  (try this one with puzzle 5)
./puz4 1 a a=dbb b=cc d=e c=
./puz4 2 a a=dbb b=cc d=e c=
./puz4 3 a a=dbb b=cc d=e c=
./puz4 3 e e=cy b=wd c=ab a=Ho y=y!
./puz4 4 @ @=@_@ _=~_~ '~='   (the '' are there to keep Unix shells from 
	interpreting the ~=; if you're on another platform, omit them)

It can produce some interesting character graphics with another tiny program, although it can run and produce some interesting output on its own.


Kragen's fourth C .signature puzzle | Kragen's home page