Esempio n. 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"));
 }
Esempio n. 2
0
 public string GetProtocol()
 {
     if (engine == null)
     {
         return("Protocol");
     }
     else
     {
         return(CData.ProtocolToStr(engine.protocol));
     }
 }
Esempio n. 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);
         }
     }
 }
Esempio n. 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);
         }
     }
 }
Esempio n. 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);
         }
     }
 }
Esempio n. 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);
        }
Esempio 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);
 }
Esempio n. 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());
 }
Esempio n. 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");
         }
     }
 }
Esempio n. 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);
 }
Esempio n. 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);
        }
Esempio n. 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);
     }
 }