2 * AI Initialization Routine -- ai-init.c
4 * http://cmancala.sourceforge.net
5 * $Source: /cvsroot/cmancala/mancala/src/Attic/ai-init.c,v $
7 * $Date: 2003/12/29 05:49:52 $
16 /* Initialize everything needed by the ai function */
19 int *aiBoard, int *humanBoard, char *filename,
20 int (*aifunc)(int *aiBoard, int *humanBoard, int depth, FILE *log)
23 int aiBoardTemp[BOARD_MAX+1], humanBoardTemp[BOARD_MAX+1];
28 if ((log = fopen(filename, "w")) == NULL) {
29 printf("Cannot open %s...\n", filename);
33 /* make a temporary copy of the boards */
34 for (k=0; k<=BOARD_MAX; k++) {
35 aiBoardTemp[k] = aiBoard[k];
36 humanBoardTemp[k] = humanBoard[k];
39 /* call the function in question */
40 bestmove = (*aifunc)(aiBoardTemp, humanBoardTemp, 0, log);
42 /* clean up and return the best move */