X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=book.c;fp=book.c;h=c81df43ea369f2a8d5c94a8003991e593f839e3c;hb=5eed4adb3552562329c0b0b460c8851efb1a38bb;hp=950e2f928c414fe8d606061c587f60cec90e85d2;hpb=446bfd706349c3e1f19916a16558a2f4f7dc8e54;p=polyglot.git diff --git a/book.c b/book.c index 950e2f9..c81df43 100644 --- a/book.c +++ b/book.c @@ -144,7 +144,7 @@ int book_move(const board_t * board, bool random) { if (move != MoveNone && move_is_legal(move,board) && - score/10>option_get_int(Option,"BookTreshold")) { + score>10*option_get_int(Option,"BookTreshold")) { // pick this move? @@ -212,10 +212,10 @@ void book_moves(list_t * list, const board_t * board) { if (entry->key != board->key) break; move = entry->move; - score = (entry->count*10000)/sum; // 32 bit safe! + score = (((uint32)entry->count)*((uint32)10000))/sum; // 32 bit safe! - if (score > 0 && move != MoveNone && move_is_legal(move,board)) { - list_add_ex(list,move,score); + if (move != MoveNone && move_is_legal(move,board)) { + list_add_ex(list,move,score); } } @@ -229,6 +229,7 @@ void book_disp(const board_t * board) { char move_string[256]; list_t list[1]; int i; + int treshold=option_get_int(Option,"BookTreshold"); ASSERT(board!=NULL); @@ -238,8 +239,15 @@ void book_disp(const board_t * board) { for(i=0; imove[i],board,move_string,256); - printf(" %6s %5.2f%%\n",move_string,list->value[i]/100.0); + if(list->value[i]>10*treshold){ + printf(" %6s %5.2f%%\n",move_string,list->value[i]/100.0); + }else{ + printf(" %6s %5.2f%% (below treshold %4.2f%%)\n", + move_string,list->value[i]/100.0,treshold/10.0); + } } + // this is necessary by the xboard protocol + printf("\n"); } // book_learn_move()