bool list_equal(list_t * list_1, list_t * list_2) { list_t copy_1[1], copy_2[1]; int i; ASSERT(list_is_ok(list_1)); ASSERT(list_is_ok(list_2)); if (list_1->size != list_2->size) return false; list_copy(copy_1,list_1); list_note(copy_1); list_sort(copy_1); list_copy(copy_2,list_2); list_note(copy_2); list_sort(copy_2); for (i = 0; i < copy_1->size; i++) { if (copy_1->move[i] != copy_2->move[i]) return false; } return true; }
void search_full_init(list_t * list, board_t * board) { const char * string; int trans_move, trans_min_depth, trans_max_depth, trans_min_value, trans_max_value; ASSERT(list_is_ok(list)); ASSERT(board_is_ok(board)); // null-move options string = option_get_string("NullMove Pruning"); if (false) { } else if (my_string_equal(string,"Always")) { UseNull = true; UseNullEval = false; } else if (my_string_equal(string,"Fail High")) { UseNull = true; UseNullEval = true; } else if (my_string_equal(string,"Never")) { UseNull = false; UseNullEval = false; } else { ASSERT(false); UseNull = true; UseNullEval = true; } NullReduction = option_get_int("NullMove Reduction"); string = option_get_string("Verification Search"); if (false) { } else if (my_string_equal(string,"Always")) { UseVer = true; UseVerEndgame = false; } else if (my_string_equal(string,"Endgame")) { UseVer = true; UseVerEndgame = true; } else if (my_string_equal(string,"Never")) { UseVer = false; UseVerEndgame = false; } else { ASSERT(false); UseVer = true; UseVerEndgame = true; } VerReduction = option_get_int("Verification Reduction"); // history-pruning options UseHistory = option_get_bool("History Pruning"); HistoryValue = (option_get_int("History Threshold") * 16384 + 50) / 100; UseExtendedHistory = option_get_bool("Toga Extended History Pruning"); HistoryBound = (option_get_int("Toga History Threshold") * 16384 + 50) / 100; // futility-pruning options UseFutility = option_get_bool("Futility Pruning"); FutilityMargin1 = option_get_int("Futility Margin"); FutilityMargin2 = option_get_int("Extended Futility Margin"); // delta-pruning options UseDelta = option_get_bool("Delta Pruning"); DeltaMargin = option_get_int("Delta Margin"); // quiescence-search options CheckNb = option_get_int("Quiescence Check Plies"); CheckDepth = 1 - CheckNb; // standard sort list_note(list); list_sort(list); // basic sort trans_move = MoveNone; if (UseTrans) trans_retrieve(Trans,board->key,&trans_move,&trans_min_depth,&trans_max_depth,&trans_min_value,&trans_max_value); note_moves(list,board,0,trans_move); list_sort(list); }
void search_full_init(list_t * list, board_t * board, int ThreadId) { const char * string; int trans_move, trans_depth, trans_flags, trans_value; int i, j; entry_t * found_entry; ASSERT(list_is_ok(list)); ASSERT(board_is_ok(board)); // null-move options string = option_get_string("NullMove Pruning"); if (false) { } else if (my_string_equal(string,"Always")) { UseNull = true; UseNullEval = false; } else if (my_string_equal(string,"Fail High")) { UseNull = true; UseNullEval = true; } else if (my_string_equal(string,"Never")) { UseNull = false; UseNullEval = false; } else { ASSERT(false); UseNull = true; UseNullEval = true; } NullReduction = option_get_int("NullMove Reduction"); string = option_get_string("Verification Search"); if (false) { } else if (my_string_equal(string,"Always")) { UseVer = true; UseVerEndgame = false; } else if (my_string_equal(string,"Endgame")) { UseVer = true; UseVerEndgame = true; } else if (my_string_equal(string,"Never")) { UseVer = false; UseVerEndgame = false; } else { ASSERT(false); UseVer = true; UseVerEndgame = true; } VerReduction = option_get_int("Verification Reduction"); // history-pruning options UseHistory = option_get_bool("History Pruning"); HistoryValue = (option_get_int("History Threshold") * 16384 + 50) / 100; // Stockfish Late Move Reductions // about 20 elo better than previous Toga History Reductions for (i = 0; i < 64; i++){ for (j = 0; j < 64; j++){ if (i == 0 || j == 0){ quietPvMoveReduction[i][j] = quietMoveReduction[i][j] = 0; } else{ double pvReduction = log((double) (i)) * log((double) (j)) / 3.0; double nonPvReduction = (1.0 + log((double) (i))) * log((double) (j)) / 2.5; // JD quietPvMoveReduction[i][j] = (int) (pvReduction >= 1.0 ? floor(pvReduction) : 0); quietMoveReduction[i][j] = (int) (nonPvReduction >= 1.0 ? floor(nonPvReduction) : 0); } } } // futility-pruning options UseFutility = option_get_bool("Futility Pruning"); FutilityMargin1 = option_get_int("Futility Margin"); FutilityMargin2 = option_get_int("Extended Futility Margin"); // delta-pruning options UseDelta = option_get_bool("Delta Pruning"); DeltaMargin = option_get_int("Delta Margin"); // quiescence-search options SearchCurrent[ThreadId]->CheckNb = option_get_int("Quiescence Check Plies"); SearchCurrent[ThreadId]->CheckDepth = 1 - SearchCurrent[ThreadId]->CheckNb; // standard sort list_note(list); list_sort(list); // misc SearchCurrent[ThreadId]->last_move = MoveNone; // basic sort trans_move = MoveNone; if (UseTrans) trans_retrieve(Trans,&found_entry,board->key,&trans_move,&trans_depth,&trans_flags,&trans_value); note_moves(list,board,0,trans_move,ThreadId); list_sort(list); }