private bool SearchImplementation() { for (int i = 0; i < 0xff; i++) { bool debugPrint = true && debug; // forward while (true) { if (debugPrint) { nodeStack.debugPrint(); } // 子ノードを取得 Node childItr = nodeStack.front(); // 盤面を進める board.Forward(childItr.moves.front()); // 着手を取得 board.GetMoveList(moveListTmp); // 新しい盤面に着手が無かったら勝負あり if (moveListTmp.empty()) { childItr.score.score = Score.SCORE_WIN; nodeStack.GetHistory(childItr.score.moveList); break; } if (deep <= nodeStack.size()) { // 新しい子が末端だったら追加せずに評価 // 親ノードに評価をマージ if (limit.score == Score.SCORE_UNVALUED || limit <= childItr.score) { scoreTmp.setScore(board.GetEvaluate(moveListTmp)); childItr.score = Score.NegaAndMin(childItr.score, scoreTmp); } nodeStack.GetHistory(childItr.score.moveList); break; } // 子供を追加してもう一回 nodeStack.push_back(moveListTmp); } // back while (true) { if (debugPrint) { nodeStack.debugPrint(); } // 子ノードを取得 Node childItr = nodeStack.front(); // 親ノードに得点をマージ if (2 <= nodeStack.size()) { Node parentItr = nodeStack.parent(); if (limit.score != Score.SCORE_UNVALUED) { if (childItr.score.Negate() < limit) { if (parentItr.score.score == Score.SCORE_UNVALUED || limit <= parentItr.score) { parentItr.score = childItr.score.Negate(); } else { //C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created: //ORIGINAL LINE: scoreTmp = childItr.score; scoreTmp.CopyFrom(childItr.score); parentItr.score.CopyFrom(Score.NegaAndMin(parentItr.score, scoreTmp)); } } } else { //C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created: //ORIGINAL LINE: scoreTmp = childItr.score; scoreTmp.CopyFrom(childItr.score); parentItr.score.CopyFrom(Score.NegaAndMin(parentItr.score, scoreTmp)); } } // 子ノードの着手を戻す board.Back(childItr.moves.front()); // スコアがwindowの外側だったら終わり if (window.score != Score.SCORE_UNVALUED && (limit.score == Score.SCORE_UNVALUED || childItr.score < limit)) { if ((nodeStack.size() & 0x1) == 0) { if (window < childItr.score) { childItr.moves.clear(); } } else { if (windowNega < childItr.score) { childItr.moves.clear(); } } } // 次の指し手を取得 if (1 < childItr.moves.size()) { childItr.moves.pop_front(); childItr.score.clear(); break; } // 次の指し手が無いので今のノードは終わり nodeStack.pop_back(); //std::cout << "end" << nodeStack.size() << std::endl; // ルートノードなので終わり if (nodeStack.size() <= 1) { CallBack("jobid:" + jobId + ",score:" + nodeStack.front().score.toJson() + ",count:" + Convert.ToString(i)); return(true); } } } // いったんお返し return(false); }