mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 09:39:36 +00:00
Added hack to avoid crash during machine learning.
This commit is contained in:
parent
9a73df7379
commit
a413bf7aad
1 changed files with 11 additions and 2 deletions
|
@ -2056,13 +2056,17 @@ void LearnerThink::thread_worker(size_t thread_id)
|
|||
};
|
||||
|
||||
StateInfo state[MAX_PLY]; // qsearchのPVがそんなに長くなることはありえない。
|
||||
bool illegal_move = false;
|
||||
for (auto m : pv)
|
||||
{
|
||||
// 非合法手はやってこないはずなのだが。
|
||||
// An illegal move sometimes comes here...
|
||||
if (!pos.pseudo_legal(m) || !pos.legal(m))
|
||||
{
|
||||
cout << pos << m << endl;
|
||||
assert(false);
|
||||
//cout << pos << m << endl;
|
||||
//assert(false);
|
||||
illegal_move = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// 各PV上のnodeでも勾配を加算する場合の処理。
|
||||
|
@ -2076,6 +2080,11 @@ void LearnerThink::thread_worker(size_t thread_id)
|
|||
Eval::evaluate_with_no_return(pos);
|
||||
}
|
||||
|
||||
if (illegal_move) {
|
||||
sync_cout << "An illical move was detected... Excluded the position from the learning data..." << sync_endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// PVの終端局面に達したので、ここで勾配を加算する。
|
||||
pos_add_grad();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue