Ejemplo n.º 1
0
        public int CheckMatch(Player Host, int matchID)
        {
            PoolMatchResult HostMatch = Host.Results[matchID];
            PoolMatchResult ThisMatch = Results[matchID];

            if (HostMatch.ScoreA != 99 && ThisMatch.ScoreA != 99)
            {
                if (HostMatch.ScoreA == ThisMatch.ScoreA && ThisMatch.ScoreB == HostMatch.ScoreB)
                {
                    return(2);
                }

                else if (ThisMatch.Winner == HostMatch.Winner)
                {
                    return(1);
                }

                else
                {
                    return(0);
                }
            }

            return(-1);
        }
Ejemplo n.º 2
0
        public List <PoolMatchResult> ReadGroupPhase(string filename, int sheet, ExcelReadSettings Settings)
        {
            Initialise(filename, sheet);
            List <PoolMatchResult> res = new List <PoolMatchResult>();

            int Groupschecked = 0;

            while (Groupschecked < Settings.TotalGroups)
            {
                int rowschecked = 0;
                while (rowschecked < Settings.GroupSize)
                {
                    double x          = 99;
                    double y          = 99;
                    int    currentRow = Settings.GroupStartRow + rowschecked;

                    if (xlRange.Cells[currentRow, Settings.GroupHomeColumn].Value2 != null && xlRange.Cells[currentRow, Settings.GroupOutColumn].Value2 != null)
                    {
                        x = xlRange.Cells[currentRow, Settings.GroupHomeColumn].Value2;
                        y = xlRange.Cells[currentRow, Settings.GroupOutColumn].Value2;
                    }
                    PoolMatchResult pmr = new PoolMatchResult(Convert.ToInt32(x), Convert.ToInt32(y));
                    res.Add(pmr);
                    rowschecked++;
                }
                Settings.GroupStartRow += Settings.GroupSize + 1;
                Groupschecked++;
            }
            Clean();
            return(res);
        }
Ejemplo n.º 3
0
        public bool Check(Player host, List <goalScorer> scorers)
        {
            if (host == null)
            {
                return(false);
            }
            //pool
            Score = 0;
            int x = 0;

            foreach (PoolMatchResult result in Results)
            {
                PoolMatchResult hostresult = host.Results[x];
                if (hostresult != null || result != null)
                {
                    if (hostresult.ScoreA != 99)
                    {
                        if (hostresult.Winner == result.Winner)
                        {
                            Score += 60;
                        }

                        if (hostresult.ScoreA == result.ScoreA)
                        {
                            Score += 20;
                        }

                        if (hostresult.ScoreB == result.ScoreB)
                        {
                            Score += 20;
                        }
                    }
                }
                x++;
            }

            //knockout
            int checkscore = KnockOut.checkKnockoutPhase(host.KnockOut);

            if (checkscore != -1)
            {
                Score += checkscore;
            }

            Score += Questions.CheckBonus(host.Questions);
            var s = findGoalscorer(scorers, Questions.Answers[BonusKeys.Topscorer].Answer);

            if (s != null)
            {
                Score += (s.goals * 20);
            }
            return(true);
        }