Esempio n. 1
0
        void Fill(int i, List <UchastChamp> uchs, ref UchastChamp u1, ref UchastChamp u2)
        {
            if (uchs.Count < i + 1)
            {
                return;
            }
            int im          = i + 1;
            int ie          = i + 2;
            int countWinGr1 = GetCountWinGroup(uchs[i]);
            int countWinGr2 = uchs.Count > im?GetCountWinGroup(uchs[im]) : 0;

            int countWinGr3 = uchs.Count > ie?GetCountWinGroup(uchs[ie]) : 0;

            if (countWinGr1 == 0 && countWinGr2 == 0 && countWinGr3 == 0)
            {
                return;
            }
            else
            {
                var cW = new SortedDictionary <int, int>();
                cW.Add(i, countWinGr1); cW.Add(im, countWinGr2); cW.Add(ie, countWinGr3);
                var j = 0;
                foreach (var c in cW)
                {
                    if (j == 2)
                    {
                        break;
                    }
                    else if (j == 0)
                    {
                        u1 = uchs[c.Key];
                    }
                    else if (j == 1)
                    {
                        u2 = uchs[c.Key];
                    }
                    j++;
                }
            }
        }
Esempio n. 2
0
 int?GetCountRule(UchastChamp u, string rule, int IDSor) => u?.Rules.Where(r => r.IDSorevnovanie == IDSor && r.Name == rule).Count();
Esempio n. 3
0
 int GetCountWinGroup(UchastChamp uc) => uc.Sorevnovanies.Where(u => u.Winner == 0 && u.Red == uc.ID || u.Winner == 1 && u.White == uc.ID).Count();