コード例 #1
0
 void uciEngine_AuthorReceived(object sender, UCIMessageEventArgs e)
 {
     if (AuthorReceived != null)
     {
         AuthorReceived(this, e);
     }
     isUciOk = true;
 }
コード例 #2
0
        private void ProcessOptionName(string uciData)
        {
            if (uciData.Contains(OptionNalimovPath))
            {
                IsNalimovPathSupported = true;
            }

            if (OptionReceived != null)
            {
                UCIMessageEventArgs e = new UCIMessageEventArgs(uciData);
                OptionReceived(this, e);
            }
            if (IsLoadParametersRequired)
            {
                Parameters.AddParameter(uciData);
            }
        }
コード例 #3
0
        private void ProcessUCIData(string uciData)
        {
            if (uciData == null)
            {
                return;
            }

            if (uciData.StartsWith("bestmove"))
            {
                //if (this.Game.Flags.IsProcessOutputInInfiniteAnalysis)
                //{
                //    this.Game.Flags.IsProcessOutputInInfiniteAnalysis = false;
                //}
                ProcessBestMove(uciData);
            }
            //else if (this.Game.Flags.IsProcessOutputInInfiniteAnalysis)
            //{
            //    return;
            //}
            else if (uciData.StartsWith("uciok"))
            {
                ProcessUciOk();
            }
            else if (uciData.StartsWith("Illegal move\n"))
            {
                if (IllegalMove != null)
                {
                    UCIIllegalMoveEventArgs e = new UCIIllegalMoveEventArgs(uciData, uciData);
                    IllegalMove(this, e);
                }
            }
            else if (uciData.StartsWith("Error\n"))
            {
                if (Error != null)
                {
                    UCIErrorEventArgs e = new UCIErrorEventArgs(uciData);
                    Error(this, e);
                }
            }
            else if (uciData.StartsWith("id name"))
            {
                string uciName = uciData.Substring("id name".Length);
                this.id = uciName;
                if (NameReceived != null)
                {
                    UCIMessageEventArgs e = new UCIMessageEventArgs(uciName);
                    NameReceived(this, e);
                }
            }
            else if (uciData.StartsWith("id author"))
            {
                string uciAuthor = uciData.Substring("id author".Length);
                this.author = uciAuthor;
                if (AuthorReceived != null)
                {
                    UCIMessageEventArgs e = new UCIMessageEventArgs(uciAuthor);
                    AuthorReceived(this, e);
                }
            }
            else if (uciData.StartsWith("option name"))
            {
                ProcessOptionName(uciData);
            }
            else if (uciData.StartsWith("readyok") && !IsKibitzer)
            {
                if (!IsHashCleared)
                {
                    SendOption(OptionClear + " " + OptionHash);
                }
            }
            else if (uciData.StartsWith("info "))
            {
                ProcessInfo(uciData);
            }
        }