Move the terminal position check to after qsearch, otherwise qsearch may end up in a terminal position.

This commit is contained in:
Tomasz Sobczyk
2020-11-22 17:18:06 +01:00
committed by nodchip
parent d43cd104b6
commit 3cee6881ee

View File

@@ -685,10 +685,6 @@ namespace Learner
int ply = 0;
pos.do_move((Move)ps.move, state[ply++]);
// We want to position being trained on not to be terminal
if (MoveList<LEGAL>(pos).size() == 0)
goto RETRY_READ;
// Evaluation value of shallow search (qsearch)
const auto [_, pv] = Search::qsearch(pos);
@@ -698,6 +694,10 @@ namespace Learner
}
}
// We want to position being trained on not to be terminal
if (MoveList<LEGAL>(pos).size() == 0)
goto RETRY_READ;
// Since we have reached the end phase of PV, add the slope here.
pos_add_grad();
}