void good_move(int move, const board_t * board, int depth, int height) { int index; int i; ASSERT(move_is_ok(move)); ASSERT(board!=NULL); ASSERT(depth_is_ok(depth)); ASSERT(height_is_ok(height)); if (move_is_tactical(move,board)) return; // killer if (Killer[height][0] != move) { Killer[height][1] = Killer[height][0]; Killer[height][0] = move; } ASSERT(Killer[height][0]==move); ASSERT(Killer[height][1]!=move); // history index = history_index(move,board); History[index] += HISTORY_INC(depth); if (History[index] >= HistoryMax) { for (i = 0; i < HistorySize; i++) { History[i] = (History[i] + 1) / 2; } } }
void bad_move(int move, const board_t * board, int depth) { int index; int i; ASSERT(move_is_ok(move)); ASSERT(board!=NULL); ASSERT(depth_is_ok(depth)); if (MOVE_IS_TACTICAL(move,board)) return; // history index = history_index(move,board); History[index] -= HISTORY_INC(depth); if (History[index] < -HistoryValue) { for (i = 0; i < HistorySize; i++) { if (History[i] >= 0) { History[i] = (History[i] + 1) / 2; } else { History[i] = (History[i] - 1) / 2; } } } HistTot[index]++; if (HistTot[index] >= HistoryMax) { HistHit[index] = (HistHit[index] + 1) / 2; HistTot[index] = (HistTot[index] + 1) / 2; } #if DEBUG if (thread_number() == 1) { ASSERT(History[index]<=HistoryValue&&History[index]>=-HistoryValue); ASSERT(HistHit[index]<=HistTot[index]); ASSERT(HistTot[index]<HistoryMax); } else { ASSERT(History[index]<=HistoryValue+8192&&History[index]>=-HistoryValue-8192); } #endif }
void good_move(int move, const board_t * board, int depth, int height, int thread, bool cut) { int index; int i; ASSERT(move_is_ok(move)); ASSERT(board!=NULL); ASSERT(depth_is_ok(depth)); ASSERT(height_is_ok(height)); ASSERT(thread_is_ok(thread)); ASSERT(cut==true||cut==false); if (MOVE_IS_TACTICAL(move,board)) return; // killer if (Killer[thread][height][0] != move) { Killer[thread][height][1] = Killer[thread][height][0]; Killer[thread][height][0] = move; } ASSERT(Killer[thread][height][0]==move); ASSERT(Killer[thread][height][1]!=move); // history index = history_index(move,board); History[index] += HISTORY_INC(depth); if (History[index] > HistoryValue) { for (i = 0; i < HistorySize; i++) { if (History[i] >= 0) { History[i] = (History[i] + 1) / 2; } else { History[i] = (History[i] - 1) / 2; } } } if (cut) { HistHit[index]++; HistTot[index]++; if (HistTot[index] >= HistoryMax) { HistHit[index] = (HistHit[index] + 1) / 2; HistTot[index] = (HistTot[index] + 1) / 2; } #if DEBUG if (thread_number() == 1) { ASSERT(HistHit[index]<=HistTot[index]); ASSERT(HistTot[index]<HistoryMax); } #endif } #if DEBUG if (thread_number() > 1) { ASSERT(History[index]<=HistoryValue+8192&&History[index]>=-HistoryValue-8192); } else { ASSERT(History[index]<=HistoryValue&&History[index]>=-HistoryValue); } #endif }