public void Run(IPersonality personality) { // TODO - restore the check Debug.Assert(/*personality != null &&*/ CurrentPosition != null); m_stats = new AnalysisStats(); m_stats.Run(personality); m_stats.UpdateBestLine(m_tree.Root, false); var legal_moves = GetLegalMoves(); if (legal_moves.Count == 0 // Only one legal move - play it without doubt || legal_moves.Count == 1) { return; } // Check the current node for the deterministic evaluation // (checkmate, stalemate or some other draw) // TODO m_tree.Root.ResetMinmaxEvaluation(); MakeStaticEvaluation(m_tree.Root); // TODO - init properly //int buffer_capacity = 1500000; ulong max_node_count = 10000000; for (int depth = 1; m_stats.NodesEvaluated < max_node_count; depth += 2) { Run(m_tree.Root, depth, max_node_count); } MinMax.Evaluate(m_tree.Root); m_stats.UpdateBestLine(m_tree.Root, true); m_stats.Stop(); // Clean the tree and restore root's children CleanAnalysisTree(); }
public void RootPositionChanged(Position.Position root_position) { CurrentPosition = root_position; m_stats = null; }