Britbot
double Britbot.Simulator.SimulatedGame.RunSimulation ( CancellationToken  cancellationToken) [inline]

Simulates the game and calculates the score.

Parameters:
cancellationToken
Returns:

Definition at line 248 of file SimulatedGame.cs.

        {
            int nextTurn = 0;

            //variables for PPT
            double PPT;

            int count = 0;

            //start going over events
            while(this.CommingEvents.Count > 0)
            {
                count++;
                //calculate PPT
                PPT = this.CalculatePpt();

                nextTurn = this.CommingEvents.First.Turn;

                //update score
                this.Score += (nextTurn - this.CurrentTurn) * PPT;

                //update iteration      
                this.CurrentTurn = nextTurn;

                //activate the comming event, if it is the end then break
                if (this.CommingEvents.Dequeue().Activate(this))
                    break;
            }

            //Logger.Write(this.MyIslandCount.ToString(),true);
            //Logger.Write(this.EnemyIslandCount.ToString(),true);


            Logger.Write("COUNT: " + count);
            return Score;
        }