void initall() { extern void initbest(),inittrans(),initplay(); initbest(); inittrans(); initplay(); }
static void game_scoremove(char*s) { char buf[MAXLINE]; int x,y; Ori o; Play p; char c; sscanf(s, "%d %d %c %s\n", &x, &y, &c, buf); o = c2ori(c); printf("scoremove [%d %d %c %s]\n", x,y,c, buf); initplay(&p, x, y, o, buf); if(!valid(&p)) { printf("play not valid\n"); return; } printf("score %d\n", score(&p.word, p.pos, p.o)); }
int main(int argc, char *argv[]) { int rflag; /* user restore request option */ rflag = 0; dbugflg = 0; while (--argc > 0) { ++argv; if (**argv != '-') break; switch (tolower(argv[0][1])) { case 'r': ++rflag; continue; case 'd': ++dbugflg; continue; default: printf("unknown flag: %c\n", argv[0][1]); continue; } /* switch */ } /* while */ if (dbugflg < 2) dbugflg = 0; /* must request three times */ opentxt(); initplay(); if (rflag) restore(); else if (yes(65, 1, 0)) limit = 1000; else limit = 330; saveflg = 0; srand(511); /* seed random */ while (!saveflg) turn(); if (saveflg) saveadv(); #ifndef EMBED fclose(fd1); fclose(fd2); fclose(fd3); fclose(fd4); #endif return (0); /* exit = ok */ }
static void game_makemove(char*s) { char buf[MAXLINE]; int x,y; Ori o; char c; Play p; sscanf(s, "%d %d %c %s\n", &x, &y, &c, buf); o = c2ori(c); printf("makemove [%d %d %c %s]\n", x,y,c, buf); initplay(&p, x, y, o, buf); wordprint(&p.word); if(!valid(&p)) { printf("play not valid\n"); return; } play(&p); boardprint(); }