예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="engineEXE"></param>
        /// <param name="engineExtraCommand"></param>
        /// <param name="runnerIndex">optional index of this runner within parallel set of runners</param>
        public UCIGameRunner(string engineEXE,
                             bool resetStateAndCachesBeforeMoves,
                             string extraCommandLineArguments = null,
                             string[] uciSetOptionCommands    = null,
                             int runnerIndex = -1)
        {
            EngineEXE = engineEXE;
            ResetStateAndCachesBeforeMoves = resetStateAndCachesBeforeMoves;
            EngineExtraCommand             = extraCommandLineArguments;
            Index = runnerIndex;

            ReadEvent readHandler = new ReadEvent(DataRead);

            string engine1Name = new FileInfo(engineEXE).Name;

            engine = StartEngine(engine1Name, engineEXE, extraCommandLineArguments, readHandler);

            System.Threading.Thread.Sleep(20);

            if (uciSetOptionCommands != null)
            {
                foreach (string extraCommand in uciSetOptionCommands)
                {
                    engine.SendCommandLine(extraCommand);
                }
            }

            freq      = Stopwatch.Frequency;
            startTime = Stopwatch.GetTimestamp();
        }
예제 #2
0
 public void Shutdown()
 {
     engine.SendCommandLine("stop");
     engine.SendCommandLine("quit");
     engine.Shutdown();
     engine = null;
 }
예제 #3
0
 protected void SendCommandCRLF(UCIEngineProcess thisEngine, string cmd)
 {
     if (UCI_VERBOSE_LOGGING)
     {
         Console.WriteLine("--> CMD " + cmd);
     }
     thisEngine.SendCommandLine(cmd);
 }
예제 #4
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);
        }