From a413bf7aad25a67c515ac44db718514cd0dc679b Mon Sep 17 00:00:00 2001 From: Hisayori Noda Date: Mon, 24 Jun 2019 23:17:46 +0900 Subject: [PATCH] Added hack to avoid crash during machine learning. --- src/learn/learner.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/learn/learner.cpp b/src/learn/learner.cpp index 34ea38c6..a0a3833a 100644 --- a/src/learn/learner.cpp +++ b/src/learn/learner.cpp @@ -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();