/********************************************************************* Hex Board Fig File Generator To compile: gcc hexbd.c -o hexbd -lm **********************************************************************/ #include #include #define FIGFILE "hexbd.fig" /* hex board fig file */ #define ROWCT 11 /* row count */ #define RADIUS 400 /* radius of hex cell */ #define X0 50 /* initial cell x offset */ #define Y0 50 /* initial cell y offset */ FILE *fp; /* fig file pointer */ int main(int argc, char *argv[]){ int r,w,i,j; int Ax,Ay,Bx,By,Cx,Cy,Dx,Dy,Ex,Ey,Fx,Fy; if ((fp=fopen(FIGFILE, "w"))==NULL){ printf("Can't open output file.\n"); exit(1); } fprintf(fp,"#FIG 3.1\n"); fprintf(fp,"#Landscape\n"); fprintf(fp,"Center\n"); fprintf(fp,"Inches\n"); fprintf(fp,"1200 2\n"); r=RADIUS; w=round(sqrt(3)*r/2); for (i=0;i=.5) r=((int)x)+1; else r=(int)x; return r; } /***************************************************************** Notes A nice 11x11 board for playing with pencils and paper rowct 11, radius 300, x_0 and y_0 1500 An 11x11 board for playing on with go stones rowct 11, radius 400, x_0 and y_0 then rotate in xfig to fit on page *****************************************************************/