Skip to content

Commit

Permalink
PvNodeで宣言勝ちのチェックを行うように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
KazApps committed Dec 28, 2024
1 parent 18441f8 commit 9f9dd2b
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions source/engine/yaneuraou-engine/yaneuraou-search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,10 @@ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, boo

// 以下は、やねうら王独自のコード。

// -----------------------
// 1手詰みか?
// -----------------------

if (!rootNode && !ttHit
#if !defined(CHECK_MATE1PLY_REGARDLESS_OF_EXCLUDED_MOVE)
&& !excludedMove
Expand All @@ -1911,10 +1915,6 @@ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, boo
// !rootnodeではなく!PvNodeの方がいいかも?
// (PvNodeでは置換表の指し手を信用してはいけないという方針なら)

// -----------------------
// 1手詰みか?
// -----------------------

// excludedMoveがある時には本当は、それを除外して詰み探索をする必要があるが、
// 詰みがある場合は、singular extensionの判定の前までにbeta cutするので、結局、
// 詰みがあるのにexcludedMoveが設定されているということはありえない。
Expand Down Expand Up @@ -1984,11 +1984,16 @@ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, boo
return bestValue;
}
}
}

// -----------------------
// 宣言勝ちか?
// -----------------------

// -----------------------
// 宣言勝ちか?
// -----------------------

// 置換表にhitしていないときは宣言勝ちの判定をまだやっていないということなので今回やる。
// PvNodeでは置換表の指し手を信用してはいけないので毎回やる。
if (!ttData.move || PvNode)
{
// 王手がかかってようがかかってまいが、宣言勝ちの判定は正しい。
// (トライルールのとき王手を回避しながら入玉することはありうるので)
// トライルールのときここで返ってくるのは16bitのmoveだが、置換表に格納するには問題ない。
Expand Down

0 comments on commit 9f9dd2b

Please sign in to comment.