예제 #1
0
 public void LoadFromIni()
 {
     tournament   = CEngineList.iniFile.ReadInt($"engine>{name}>tournament", tournament);
     modeStandard = CEngineList.iniFile.ReadBool($"engine>{name}>modeStandard", modeStandard);
     file         = CEngineList.iniFile.Read($"engine>{name}>file", "Human");
     protocol     = CData.StrToProtocol(CEngineList.iniFile.Read($"engine>{name}>protocol", "Uci"));
     parameters   = CEngineList.iniFile.Read($"engine>{name}>parameters", "");
     options      = CEngineList.iniFile.ReadList($"engine>{name}>options");
     elo          = CEngineList.iniFile.Read($"engine>{name}>elo", elo);
     hisElo.LoadFromStr(CEngineList.iniFile.Read($"engine>{name}>history"));
 }
예제 #2
0
 public string GetProtocol()
 {
     if (engine == null)
     {
         return("Protocol");
     }
     else
     {
         return(CData.ProtocolToStr(engine.protocol));
     }
 }
예제 #3
0
 private void FormHisE_VisibleChanged(object sender, EventArgs e)
 {
     if (Visible == true)
     {
         chart1.Series.Clear();
         CModeTournamentE.engineList.SortElo();
         foreach (CEngine engine in CModeTournamentE.engineList.list)
         {
             string en = engine.name;
             chart1.Series.Add(en);
             chart1.Series[en].ChartType   = SeriesChartType.Line;
             chart1.Series[en].BorderWidth = 2;
             CData.HisToPoints(engine.hisElo, chart1.Series[en].Points);
         }
     }
 }
예제 #4
0
 private void FormHisP_VisibleChanged(object sender, EventArgs e)
 {
     if (Visible == true)
     {
         chart1.Series.Clear();
         CModeTournamentP.playerList.SortElo();
         foreach (CPlayer player in CModeTournamentP.playerList.list)
         {
             string pn = player.name;
             chart1.Series.Add(pn);
             chart1.Series[pn].ChartType   = SeriesChartType.Line;
             chart1.Series[pn].BorderWidth = 2;
             CData.HisToPoints(player.hisElo, chart1.Series[pn].Points);
         }
     }
 }
예제 #5
0
 private void FormHisB_VisibleChanged(object sender, EventArgs e)
 {
     if (Visible == true)
     {
         chart1.Series.Clear();
         CModeTournamentB.bookList.SortElo();
         foreach (CBook book in CModeTournamentB.bookList.list)
         {
             string bn = book.name;
             chart1.Series.Add(bn);
             chart1.Series[bn].ChartType   = SeriesChartType.Line;
             chart1.Series[bn].BorderWidth = 2;
             CData.HisToPoints(book.hisElo, chart1.Series[bn].Points);
         }
     }
 }
예제 #6
0
        public string GetName()
        {
            if (name != "")
            {
                return(name);
            }
            string n = CData.MakeShort(Path.GetFileNameWithoutExtension(exe));

            string[] tokens = parameters.Split(' ');
            if (tokens.Length > 0)
            {
                string p = tokens[0];
                p = Path.GetFileNameWithoutExtension(p);
                return($"{n} {p}");
            }
            return(n);
        }
예제 #7
0
 public CGamer GetGamerPid(int pid, out string protocol)
 {
     foreach (CGamer g in gamer)
     {
         if (g.bookPro.GetPid() == pid)
         {
             protocol = "Book";
             return(g);
         }
         if (g.enginePro.GetPid() == pid)
         {
             protocol = CData.ProtocolToStr(g.engine.protocol);
             return(g);
         }
     }
     protocol = "";
     return(null);
 }
예제 #8
0
 public void SaveToIni()
 {
     name = GetName();
     if (hisElo.list.Count == 0)
     {
         int e = GetElo();
         hisElo.Add(e);
         hisElo.Add(e);
     }
     CEngineList.iniFile.Write($"engine>{name}>tournament", tournament);
     CEngineList.iniFile.Write($"engine>{name}>modeStandard", modeStandard);
     CEngineList.iniFile.Write($"engine>{name}>file", file);
     CEngineList.iniFile.Write($"engine>{name}>protocol", CData.ProtocolToStr(protocol));
     CEngineList.iniFile.Write($"engine>{name}>parameters", parameters);
     CEngineList.iniFile.Write($"engine>{name}>options", options);
     CEngineList.iniFile.Write($"engine>{name}>elo", elo);
     CEngineList.iniFile.Write($"engine>{name}>history", hisElo.SaveToStr());
 }
예제 #9
0
 void SelectEngine()
 {
     optionList.list.Clear();
     Uciok();
     tbEngineName.Text      = engine.name;
     tbParameters.Text      = engine.parameters;
     cbFileList.Text        = engine.GetFile();
     cbProtocol.Text        = CData.ProtocolToStr(engine.protocol);
     cbModeStandard.Checked = engine.modeStandard;
     nudElo.Value           = Convert.ToInt32(engine.elo);
     nudTournament.Value    = engine.tournament;
     if ((engine.protocol == CProtocol.uci) && engine.FileExists())
     {
         if (process.SetProgram($@"{AppDomain.CurrentDomain.BaseDirectory}Engines\{engine.file}", engine.parameters) > 0)
         {
             process.WriteLine("uci");
         }
     }
 }
예제 #10
0
 public string GetName()
 {
     if (name == String.Empty)
     {
         string n = "Human";
         string b = String.Empty;
         string m = String.Empty;
         if (engine != "Human")
         {
             n = engine;
             m = modeValue.ShortName();
         }
         if (book != "None")
         {
             b = $" {CData.MakeShort(book)}";
         }
         name = $"{n}{b}{m}";
     }
     return(name);
 }
예제 #11
0
        void SaveToIni(CEngine e)
        {
            e.name         = tbEngineName.Text;
            e.file         = cbFileList.Text;
            e.protocol     = CData.StrToProtocol(cbProtocol.Text);
            e.parameters   = tbParameters.Text;
            e.modeStandard = cbModeStandard.Checked;
            e.elo          = nudElo.Value.ToString();
            e.tournament   = (int)nudTournament.Value;
            e.options      = GetOptions();
            e.SaveToIni();
            UpdateListBox();
            int index = listBox1.FindString(e.name);

            if (index == -1)
            {
                return;
            }
            listBox1.SetSelected(index, true);
        }
예제 #12
0
 private void FormEngine_Shown(object sender, EventArgs e)
 {
     FormOptions.SetFontSize(this);
     CData.UpdateFileEngine();
     cbFileList.Items.Clear();
     foreach (string engine in CData.fileEngine)
     {
         cbFileList.Items.Add(engine);
     }
     foreach (string engine in CData.fileEngineUci)
     {
         cbFileList.Items.Add($@"Uci\{engine}");
     }
     foreach (string engine in CData.fileEngineWb)
     {
         cbFileList.Items.Add($@"Winboard\{engine}");
     }
     UpdateListBox();
     if (listBox1.Items.Count > 0)
     {
         listBox1.SetSelected(0, true);
     }
 }