예제 #1
0
        private void UpdateCountersAtEndOfSim(MonteCarloSimResult bwo)
        {
            MonteCarloSimState update = new MonteCarloSimState();
            update.nRuns = bwo.nRuns;
            update.iThread = -1;
            update.nTotalThrows = Sum(bwo.nThrowsList);
            update.nInfinateLoops = bwo.nInfiniteLoops;
            update.nTotalWars = Sum(bwo.nTotalWarsList);
            update.nTotalTies = Sum(bwo.nTiesList);
            update.nTotalSingleWars = Sum(bwo.nSingleWarsList);
            update.nTotalDoubleWars = Sum(bwo.nDoubleWarsList);
            update.nTotalTripleWars = Sum(bwo.nTripleWarsList);
            update.nTotalQuadWars = Sum(bwo.nQuadWarsList);
            update.nTotalFiveWars = Sum(bwo.nFiveWarsList);
            update.nTotalSixWars = Sum(bwo.nSixWarsList);
            update.nTotalSevenWars = Sum(bwo.nSevenWarsList);

            int iProgress = 100;
            MonteCarloSim_ProgressChanged(this, new ProgressChangedEventArgs(iProgress, update));
        }
예제 #2
0
        private void MonteCarloSimUpdateProgress(BackgroundWorker bw, MonteCarloSimResult bwo, int iRun, MonteCarloSimArgs args)
        {
            MonteCarloSimState update = new MonteCarloSimState();
            update.nRuns = bwo.nRuns;
            update.iThread = args.iThread;
            update.nTotalThrows = Sum(bwo.nThrowsList);
            update.nInfinateLoops = bwo.nInfiniteLoops;
            update.nTotalWars = Sum(bwo.nTotalWarsList);
            update.nTotalTies = Sum(bwo.nTiesList);
            update.nTotalSingleWars = Sum(bwo.nSingleWarsList);
            update.nTotalDoubleWars = Sum(bwo.nDoubleWarsList);
            update.nTotalTripleWars = Sum(bwo.nTripleWarsList);
            update.nTotalQuadWars = Sum(bwo.nQuadWarsList);
            update.nTotalFiveWars = Sum(bwo.nFiveWarsList);
            update.nTotalSixWars = Sum(bwo.nSixWarsList);
            update.nTotalSevenWars = Sum(bwo.nSevenWarsList);

            bw.ReportProgress((int)(100.0 * iRun / (double)args.nGames), update);
        }