Exemplo n.º 1
0
        /// <summary>
        /// Send the latest "best move" to the GUI.
        /// </summary>
        private void UpdateGui(int depth, int score)
        {
            MoveReport mr = new MoveReport(bestMove, depth, score, currentHeuristicScore);

            if (!stopSearch)
            {
                gui.DisplayEngineMove(mr);              //calling this after search is stopped leads to a deadlock situation because the GUI thread has called Join on this thread
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Updates the "lblEngineMove" label to show the given move. Safe to call from other threads.
 /// </summary>
 /// <param name="mr"></param>
 public void DisplayEngineMove(MoveReport mr)
 {
     if (lblEngineMove.InvokeRequired)
     {
         var d = new SafeCallDelegate(DisplayEngineMove);
         lblEngineMove.Invoke(d, new object[] { mr });
     }
     else
     {
         TopEngineMove      = mr.move;
         lblEngineMove.Text = mr.ToString();
         lblEval.Text       = "Current pos heuristic value:\n" + mr.currentHeuristicScore.ToString();
     }
 }