// USIプロトコル経由で値を設定されたときにそれをcurrentValueに反映させる。 Option& Option::operator=(const string& v) { ASSERT_LV1(!type.empty()); // 範囲外 if ((type != "button" && v.empty()) || (type == "check" && v != "true" && v != "false") || (type == "spin" && (stoi(v) < min || stoi(v) > max))) return *this; // ボタン型は値を設定するものではなく、単なるトリガーボタン。 // ボタン型以外なら入力値をcurrentValueに反映させてやる。 if (type != "button") currentValue = v; // 値が変化したのでハンドラを呼びだす。 if (on_change) on_change(*this); return *this; }
// USIプロトコル経由で値を設定されたときにそれをcurrentValueに反映させる。 Option& Option::operator=(const string& v) { ASSERT_LV1(!type.empty()); // 範囲外なら設定せずに返る。 // "EvalDir"などでstringの場合は空の文字列を設定したいことがあるので"string"に対して空の文字チェックは行わない。 if (((type != "button" && type != "string") && v.empty()) || (type == "check" && v != "true" && v != "false") || (type == "spin" && (stoll(v) < min || stoll(v) > max))) return *this; // ボタン型は値を設定するものではなく、単なるトリガーボタン。 // ボタン型以外なら入力値をcurrentValueに反映させてやる。 if (type != "button") currentValue = v; // 値が変化したのでハンドラを呼びだす。 if (on_change) on_change(*this); return *this; }
void init_min_index_flag() { // mir_piece、inv_pieceの初期化が終わっていなければならない。 ASSERT_LV1(mir_piece(Eval::f_hand_pawn) == Eval::f_hand_pawn); // 次元下げ用フラグ配列の初期化 // KPPPに関しては関与しない。 KK g_kk; g_kk.set(SQ_NB, Eval::fe_end, 0); KKP g_kkp; g_kkp.set(SQ_NB, Eval::fe_end, g_kk.max_index()); KPP g_kpp; g_kpp.set(SQ_NB, Eval::fe_end, g_kkp.max_index()); u64 size = g_kpp.max_index(); min_index_flag.resize(size); #pragma omp parallel { #if defined(_OPENMP) // Windows環境下でCPUが2つあるときに、論理64コアまでしか使用されないのを防ぐために // ここで明示的にCPUに割り当てる int thread_index = omp_get_thread_num(); // 自分のthread numberを取得 WinProcGroup::bindThisThread(thread_index); #endif #pragma omp for schedule(dynamic,20000) for (s64 index_ = 0; index_ < (s64)size; ++index_) { // OpenMPの制約からループ変数は符号型でないといけないらしいのだが、 // さすがに使いにくい。 u64 index = (u64)index_; if (g_kk.is_ok(index)) { // indexからの変換と逆変換によって元のindexに戻ることを確認しておく。 // 起動時に1回しか実行しない処理なのでASSERT_LV1で書いておく。 ASSERT_LV1(g_kk.fromIndex(index).toIndex() == index); KK a[KK_LOWER_COUNT]; g_kk.fromIndex(index).toLowerDimensions(a); // 次元下げの1つ目の要素が元のindexと同一であることを確認しておく。 ASSERT_LV1(a[0].toIndex() == index); u64 min_index = UINT64_MAX; for (auto& e : a) min_index = std::min(min_index, e.toIndex()); min_index_flag[index] = (min_index == index); } else if (g_kkp.is_ok(index)) { ASSERT_LV1(g_kkp.fromIndex(index).toIndex() == index); KKP x = g_kkp.fromIndex(index); KKP a[KKP_LOWER_COUNT]; x.toLowerDimensions(a); ASSERT_LV1(a[0].toIndex() == index); u64 min_index = UINT64_MAX; for (auto& e : a) min_index = std::min(min_index, e.toIndex()); min_index_flag[index] = (min_index == index); } else if (g_kpp.is_ok(index)) { ASSERT_LV1(g_kpp.fromIndex(index).toIndex() == index); KPP x = g_kpp.fromIndex(index); KPP a[KPP_LOWER_COUNT]; x.toLowerDimensions(a); ASSERT_LV1(a[0].toIndex() == index); u64 min_index = UINT64_MAX; for (auto& e : a) min_index = std::min(min_index, e.toIndex()); min_index_flag[index] = (min_index == index); } else { ASSERT_LV3(false); } } } }