private void ExecuteVsSelf(object obj) { ClientLog.FilePath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + DateTime.Now.ToString("MM-dd HH-mm-ss") + "~ZenVsZen.sgf"; DllImport.ClearBoard(); moveCount = 0; new Thread(() => { ClientLog.WriteLog("(;WP[Zen]BP[Zen]"); while (true) { int nextColor = DllImport.GetNextColor(); DllImport.StartThinking(nextColor); Thread.Sleep(1500); DllImport.StopThinking(); bool isThinking = DllImport.IsThinking(); int p0 = 0, p1 = 0; bool p2 = false, p3 = false; DllImport.ReadGeneratedMove(ref p0, ref p1, ref p2, ref p3); string msg = string.Format("Turn:{0}, Generated:\t{1}{2}\t{3}\t{4}", nextColor, (char)('A' + p0), p1 + 1, p2, p3); //ClientLog.WriteLog(msg); Console.WriteLine(msg);//WriteMsgLine(msg); //int para0 = 0, para1 = 0, para2 = 0, para3 = 0, para6 = 0; //float para4 = 0; //byte[] para5 = new byte[19 * 19]; //DllImport.GetTopMoveInfo(para0, ref para1, ref para2, ref para3, ref para4, para5, para6); //msg = string.Format("Turn:{0}, TopMoveInfo:\t{1}{2}\t{3}\t{4}", nextColor, (char)('A' + para1), para2 + 1, para3, para4); //ClientLog.WriteLog(msg); //int[] output = new int[19 * 19]; //DllImport.GetTerritoryStatictics(output); //ArrayChanged?.Invoke(output); if (p2 || p3) { ClientLog.WriteLog(")"); //MessageBox.Show("down"); return; } DllImport.Play(p0, p1, nextColor); moveCount++; ClientLog.WriteLog(";" + (nextColor == 1 ? "W" : "B") + "[" + (char)('a' + p0) + (char)('a' + p1) + "]"); //return; } }).Start(); }
private void ExecuteVsGnugo(object obj) { VsGnugo vsgnugo = new VsGnugo(); OnExit += vsgnugo.Exit; vsgnugo.OnMsgOutput += Vsgnugo_OnMsgOutput; vsgnugo.Start(); ClientLog.FilePath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "让八子" + testCount + "~ZenVsGnugo.sgf"; DllImport.ClearBoard(); DllImport.FixedHandicap(9); DllImport.SetNumberOfSimulations(5000); moveCount = 0; ClientLog.WriteLog("(;AB[pd][dd][pp][jj][dj][pj][jp][jd][dp]BP[gnugo]WP[Zen]");//9 //ClientLog.WriteLog("(;AB[pd][dd][pp][dj][pj][jp][jd][dp]BP[gnugo]WP[Zen]");//8 //new Thread(() => // { // Thread.Sleep(2000); // vsgnugo.GenMove(2); // }).Start(); new Thread(() => { int nextColor = DllImport.GetNextColor(); DllImport.StartThinking(nextColor); Thread.Sleep(5000); DllImport.StopThinking(); int p0 = 0, p1 = 0; bool p2 = false, p3 = false; DllImport.ReadGeneratedMove(ref p0, ref p1, ref p2, ref p3); DllImport.Play(p0, p1, nextColor); moveCount++; string msg = string.Format(moveCount + "\tZen:\t{0}", "" + (char)('A' + p0) + (p1 + 1)); Console.WriteLine(msg);//WriteMsgLine(msg); ClientLog.WriteLog(";" + (nextColor == 1 ? "W" : "B") + "[" + (char)('a' + p0) + (char)('a' + p1) + "]"); //nextColor = DllImport.GetNextColor(); char gnuX = (char)('A' + p0); if (gnuX > 'H') { gnuX++; } vsgnugo.InputMove(nextColor, "" + gnuX + (p1 + 1)); }).Start(); }