使用以下代码请遵循使用C#实现与ELEEYE引擎的基本通讯协议.

 

ChessEngine
public static class ChessEngine
{
    
public static string NextStep(string FEN, bool isRed, int timeSpan)
    {
        Process proEngine 
= new Process();

        proEngine.StartInfo.FileName 
= "eleeye.exe";

        proEngine.StartInfo.CreateNoWindow 
= true;
        proEngine.StartInfo.RedirectStandardError 
= true;
        proEngine.StartInfo.RedirectStandardInput 
= true;
        proEngine.StartInfo.RedirectStandardOutput 
= true;
        proEngine.StartInfo.UseShellExecute 
= false;

        proEngine.Start();

        proEngine.StandardInput.WriteLine(
"ucci");
        proEngine.StandardInput.WriteLine(
"setoption batch on");
        proEngine.StandardInput.WriteLine(
"position fen " + FEN + " " + (isRed ? "w" : "b"+ " - - 0 0");
        proEngine.StandardInput.WriteLine(
"go time " + timeSpan.ToString());
        proEngine.StandardInput.WriteLine(
"quit");
        
string output = proEngine.StandardOutput.ReadToEnd();
        proEngine.Close();
        Regex regex 
= new Regex(@"bestmove\s.*?\n");
        
return regex.Match(output).Group[0].Substring(94);
    }
}

 

参考代码: http://www.cnblogs.com/zcsor/archive/2009/10/23/1588641.html

相关文章:

  • 2021-10-15
  • 2022-12-23
  • 2023-03-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-31
  • 2022-12-23
  • 2021-10-12
  • 2021-09-30
  • 2021-05-24
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案