public static void PermutateGames(GameList games, Action <GameList, List <int>, List <TeamResult>, int, double> callback)
        {
            GamePermutator permutator = new GamePermutator();
            Thread         thread     = new Thread(delegate()
            {
                permutator.doPermutateGames(games, callback);
            });

            thread.Start();
        }
Beispiel #2
0
        private DivisionScenarioAnalyzer(League league, string conferenceName, string divisionName, string teamName, bool fastMode, Action <long, double, TimeSpan> progressCallback, Action <List <string>, TimeSpan> finishedCallback)
        {
            mLeague = league;
            mTeam   = teamName != null?league.FindTeam(teamName) : null;

            mProgressCallback = progressCallback;
            mFinishedCallback = finishedCallback;

            ScenariosCalculated = new List <int> {
                0, 0, 0
            };
            ScenarioTimes = new List <double> {
                0, 0, 0
            };

            mDivision = league.FindDivision(conferenceName, divisionName);

            //Prepare the list of team Ids and division winner counts
            TeamIds      = Team.GetTeamIds(mDivision.Teams);
            WinnerCounts = new Dictionary <int, int>();
            TieCounts    = new Dictionary <int, int>();
            lock (WinnerCounts)
            {
                foreach (int teamId in TeamIds)
                {
                    //Entries for outright winner, 1/2/3/etc.-way tie-breakers, and no-win ties
                    WinnerCounts.Add(teamId, 0);
                    TieCounts.Add(teamId, 0);
                }
            }

            //Get all games involving division teams
            mGames = mDivision.AllGames;

            if (fastMode)
            {
                mJudge = new DivisionWinnerCalculator(league, mDivision, mGames, JudgmentReady);
            }

            //Explore every permutation of game scenarios
            GamePermutator.PermutateGames(mGames, PermutationReady);
        }