Skip to content

Commit

Permalink
- peta_shock_next2で指定された書き出す個数に局面数が満たない時に落ちてたの修正。
Browse files Browse the repository at this point in the history
  - その周りでコンパイル時にwarning出てたの修正。
  • Loading branch information
yaneurao committed Jan 19, 2024
1 parent 0685833 commit 9d7ac45
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/book/makebook2023.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,8 @@ namespace MakeBook2023
// ⇨ 安定sortでないと、一度遭遇した局面だから、棋譜がそこまでしか得られなくなってしまう。
// ⇨ 合流した時、棋譜を破棄した方がいいか…。

std::partial_sort(kifs.begin(), kifs.begin() + next_nodes0 , kifs.end(),
u64 sort_num = std::min(next_nodes0, u64(kifs.size()));
std::partial_sort(kifs.begin(), kifs.begin() + sort_num , kifs.end(),
[pv_color](const KIF_EVAL& x, const KIF_EVAL& y) {
// 格納されている評価値は先手から見た評価値となっている。
// pv_colorが先手であるなら、評価値を昇順に並び替えて前からnext_nodes0 個取り出す。
Expand All @@ -1573,7 +1574,7 @@ namespace MakeBook2023
});

// ここで得られた棋譜、あとでまとめて書き出す。
for(size_t i = 0 ; i < std::min(kifs.size(), next_nodes0) ; ++i)
for(u64 i = 0 ; i < sort_num ; ++i)
{
write_sfens.insert(kifs[i].first);
//cout << kifs[i].first << " , " << kifs[i].second << endl;
Expand Down

0 comments on commit 9d7ac45

Please sign in to comment.