コード例 #1
0
        public void ComputeWins(EditorModel model)
        {
            wins        = 0;
            playoffExit = 0;

            foreach (TableRecordModel record in model.TableModels[EditorModel.SCHEDULE_TABLE].GetRecords())
            {
                ScheduleRecord rec = (ScheduleRecord)record;

                if (rec.HomeTeam.TeamId == TeamId || rec.AwayTeam.TeamId == TeamId)
                {
                    if (rec.WeekNumber < 17)
                    {
                        // If it's a regular season week, then add to their number of wins
                        if (rec.Winner() == TeamId)
                        {
                            wins++;
                        }
                    }
                    else if (rec.WeekNumber < 20 && rec.Loser() == TeamId)
                    {
                        // If it's a non-Superbowl playoff game, record the exit value
                        playoffExit = rec.WeekNumber - 16;
                    }
                    else if (rec.WeekNumber == 20)
                    {
                        if (rec.Loser() == TeamId)
                        {
                            playoffExit = 4;
                        }
                        else if (rec.Winner() == TeamId)
                        {
                            playoffExit = 5;
                        }
                    }
                }
            }
        }
コード例 #2
0
        public void ComputeStrengthOfSchedule(EditorModel model)
        {
            strengthOfSchedule = 0;

            foreach (TableRecordModel record in model.TableModels[EditorModel.SCHEDULE_TABLE].GetRecords())
            {
                ScheduleRecord rec = (ScheduleRecord)record;

                if (rec.WeekNumber < 17)
                {
                    if (rec.HomeTeam.TeamId == TeamId)
                    {
                        strengthOfSchedule += rec.AwayTeam.Wins;
                    }
                    else if (rec.AwayTeam.TeamId == TeamId)
                    {
                        strengthOfSchedule += rec.HomeTeam.Wins;
                    }
                }
            }

            effectiveSOS = 1000 * playoffExit + strengthOfSchedule;
        }