Example #1
0
        private GnuGoLauncher(GnuGoSettings settings, string sgfFile)
        {
            var path = WinCEUtils.PathTo("gnugoce.exe");

            if (!File.Exists(path))
            {
                throw new GnuGoException(GnuGoError.ExecutableNotFound);
            }

            StopGnuGo();

            var info = new ProcessStartInfo(path, "--mode gtp --quiet --port " + Port)
            {
                UseShellExecute  = false,
                WorkingDirectory = WinCEUtils.GetCurrentDirectory()
            };

            gnugo = Process.Start(info);
            if (gnugo.HasExited)
            {
                throw new GnuGoException(GnuGoError.CouldNotStart);
            }

            client = new TcpClient("localhost", Port);
            if (!client.Client.Connected)
            {
                throw new GnuGoException(GnuGoError.CouldNotConnect);
            }

            stream = client.GetStream();
            buffer = new byte[4096];

            gtp = new GTP(this,
                          settings.BoardSize,
                          settings.Handicap,
                          settings.Komi,
                          settings.Level,
                          sgfFile);
        }
Example #2
0
 private static string GetFilename()
 {
     return(WinCEUtils.PathTo("config.xml"));
 }