Author: Lukas Geyer Description: Made all score variables long int, also fixed several format mismatches in fprintf(): Bugs: #192902 --- sjeng-11.2.orig/newbook.c +++ sjeng-11.2/newbook.c @@ -43,7 +43,7 @@ typedef struct { unsigned long played; - signed long score; + long int score; } posinfo_t; typedef struct @@ -118,7 +118,6 @@ posinfo_t *pst; datum index; datum data; - int win = 0, loss = 0; int ret; /* fill in the key field */ @@ -461,7 +460,7 @@ int raw; int num_moves, i; char output[6]; - signed long scores[MOVE_BUFF], best_score = 0; + long int scores[MOVE_BUFF], best_score = 0; srand(time(0)); @@ -524,7 +523,7 @@ comp_to_coord(moves[i], output); - printf("Move %s: %ld times played, %d learned\n", output, + printf("Move %s: %ld times played, %ld learned\n", output, ps->played, ps->score); if ((ps->played + ps->score) >= PLAYTHRESHOLD) @@ -593,7 +592,7 @@ void book_learning(int result) { - GDBM_FILE binbook; + GDBM_FILE binbook = NULL; hashkey_t key; posinfo_t *ps; datum index; @@ -675,7 +674,7 @@ } /* don't 'overlearn' */ - if (abs((ps->score)+pi) < (ps->played*5)) + if ((unsigned long)labs((ps->score)+pi) < (ps->played*5)) { printf("Learning opening %lu, played %lu, old score %ld, new score %ld\n",