\datethis @* Data for dancing. This program creates data suitable for the {\mc DANCE} routine, solving the famous ``$n$ queens problem.'' The value of~$n$ is a command-line parameter. @c #include #include @@; @; @# main(argc,argv) int argc; char *argv[]; { register int j,k,n,nn,t; @; @; @; } @ @= if (argc!=2 || sscanf(argv[1],"%d",¶m)!=1) { fprintf(stderr,"Usage: %s n\n",argv[0]); exit(-1); } n=param; nn=n+n-2; @ @= int param; @ We process the cells of the board in ``organ pipe order,'' on the assumption that---all other things being equal---a move near the center yields more constraints on the subsequent search. @= for (j=0;j>1; printf("r%c c%c ",encode(t),encode(t)); } printf("|"); for (j=1;j= char encode(x) int x; { if (x<10) return '0'+x; return 'a'-10+x; } @ @= for (j=0;j