Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="exe"></param>
        /// <param name="extraCommand"></param>
        /// <param name="readHandler"></param>
        /// <param name="numThreads">N.B. when doing single static position evals from LC0, must set to 1</param>
        /// <returns></returns>
        UCIEngineProcess StartEngine(string engineName, string exePath, string extraCommand, ReadEvent readHandler, int numThreads = 1)
        {
            UCIEngineProcess engine = new UCIEngineProcess(engineName, exePath, extraCommand);

            engine.ReadEvent += readHandler;
            engine.StartEngine();

            engine.ReadAsync();

            engine.SendCommandLine("uci");
            engine.SendIsReadyAndWaitForOK();

            return(engine);
        }
Beispiel #2
0
        /// <summary>
        /// Executes any preparatory UCI commands before sending a position for evaluation.
        /// These preparatory steps are typically not counted in the search time for the engine.
        /// </summary>
        /// <param name="engineNum"></param>
        public void EvalPositionPrepare()
        {
            if (ResetStateAndCachesBeforeMoves)
            {
                // Not all engines support Clear hash, e.g.
                // "option name Clear Hash type button"
                // so we do not issue this command.
                //thisEngine.SendCommandLine("setoption name Clear Hash");

                // Perhaps ucinewgame helps reset state
                engine.SendCommandLine("ucinewgame");
                engine.SendIsReadyAndWaitForOK();
            }

            havePrepared = true;
        }