コード例 #1
0
ファイル: ConfigManager.cs プロジェクト: momoewang/igoenchi
 public Settings()
 {
     DefaultFontName     = "Tahoma";
     DefaultEncodingName = "utf-8";
     CurrentAccountName  = IGSAccount.DefaultAccount.Name;
     Accounts            = new List <IGSAccount>();
     Renderer            = RendererType.GDI;
     KeepCursor          = false;
     FriendsNotify       = true;
     ChatNotify          = true;
     SortModes           = new SortModes()
     {
         Games   = "",
         Players = ""
     };
     ButtonBindings = new string[0];
     GnuGoSettings  = GnuGoSettings.Default;
 }
コード例 #2
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);
        }
コード例 #3
0
        public static GTP Run(GnuGoSettings settings, string sgfFile)
        {
            var launcher = new GnuGoLauncher(settings, sgfFile);

            return(launcher.gtp);
        }
コード例 #4
0
ファイル: GnuGoDialog.cs プロジェクト: momoewang/igoenchi
        public GnuGoDialog(GnuGoSettings defaults, bool resume)
        {
            boardSizeUpDown = new NumericUpDown()
            {
                Minimum = 5,
                Maximum = 19,
                Value   = defaults.BoardSize,
                Enabled = !resume
            };

            handicapUpDown = new NumericUpDown()
            {
                Minimum = 0,
                Maximum = 9,
                Value   = defaults.Handicap,
                Enabled = !resume
            };

            komiTextBox = new TextBox()
            {
                Text    = ConfigManager.FloatToString(defaults.Komi),
                Enabled = !resume
            };

            gnugoLevel = new TrackBar()
            {
                Minimum = 0,
                Maximum = 10,
                Value   = defaults.Level
            };

            gnugoBlack = new RadioButton()
            {
                Text    = "Black",
                Checked = defaults.Color == GnuGoColor.Black
            };

            gnugoWhite = new RadioButton()
            {
                Text    = "White",
                Checked = defaults.Color == GnuGoColor.White
            };

            gnugoBoth = new RadioButton()
            {
                Text    = "Both",
                Checked = defaults.Color == GnuGoColor.Both
            };

            gnugoNone = new RadioButton()
            {
                Text    = "None",
                Checked = defaults.Color == GnuGoColor.None
            };

            foreach (var item in new Control[]
            {
                boardSizeUpDown, komiTextBox, handicapUpDown,
                gnugoLevel, gnugoBlack, gnugoWhite, gnugoBoth, gnugoNone
            })
            {
                Layout.Resize(item);
            }

            Layout.Bind(
                Layout.PropertyTable(
                    Layout.Label("Board size"), boardSizeUpDown,
                    Layout.Label("Handicap"), handicapUpDown,
                    Layout.Label("Komi"), komiTextBox,
                    Layout.Label("GNU Go Level"), gnugoLevel,
                    Layout.Label("GNU Go Plays"), gnugoBlack,
                    null, gnugoWhite,
                    null, gnugoBoth,
                    null, gnugoNone),
                this);
        }
コード例 #5
0
ファイル: GnuGoDialog.cs プロジェクト: momoewang/igoenchi
 public GnuGoDialog(GnuGoSettings defaults) : this(defaults, false)
 {
 }