Exemple #1
0
        /// <summary>
        /// EventHandler for the chess engine.This handler is invoked(after
        /// subscription) when the engine has received any output from the engine
        /// </summary>
        /// <param name="sender">Ignored</param>
        /// <param name="e">string response from the chess engine</param>
        private void ChessEngineVerboseOutputReceivedEventHandler(object sender, ChessEngineResponseReceivedEventArgs e)
        {
            // Removing the thinking lines to declutter the debug outbput
            if (!e.Response.StartsWith("info"))
            {
                Debug.WriteLine(String.Concat("<=Engine: ", e.Response));
            }

            // Build the progress text bar
            StringBuilder sb = new StringBuilder(": [");

            sb.Insert(0, ThinkingLocalized);
            sb.Append('\u25AB', 75);
            sb.Append(']');
            // Replace the current spinning index to the marker character
            sb.Replace('\u25AB', '\u25AA', 11, thinkingIndex);
            board.ThinkingText = sb.ToString();

            // Wrap the progress counter index.  It moves between the '[' and ']' chars
            if (thinkingIndex < 75)
            {
                thinkingIndex++;
            }
            else
            {
                thinkingIndex = 0;
            }
        }
Exemple #2
0
 /// <summary>
 /// EventHandler for the chess engine.  This handler is invoked (after
 /// subscription) when the engine has finished processing a command
 /// </summary>
 /// <param name="sender">Ignored</param>
 /// <param name="e">Contains the final response string</param>
 private void ChessEngineResponseReceivedEventHandler(object sender, ChessEngineResponseReceivedEventArgs e)
 {
     if (selfPlay)
     {
         // Likely common code, but it's working so leave it for now
         OnEngineSelfPlayResponseHandler(e.Response);
     }
     else
     {
         OnEngineNormalPlayResponseHandler(e.Response);
     }
 }