Exemplo n.º 1
0
        private void bRunAgent_Click(object sender, EventArgs e)
        {
            //Thread t = new Thread(() =>
            //    {
            Game1 game = StaticData.EngineManager.Game1;

            PairCTP.Sort(PairCTPComparator);
            GenSimAgentWrapper agent = new GenSimAgentWrapper(this.PairCTP, 20, false);

            agent.ScatterComps();

            StaticData.EngineManager.Game1 = game;
            if (agent.WAgent.IsSuccess)
            {
                LevelBuilder.CreateRestedLevel(agent.WAgent.LevelStr, false);
                CTRLevelDesigner.SaveEngineState();
                StaticData.GameSessionMode = SessionMode.PlayingMode;
                LivePlayabilitySimulator simulator = new LivePlayabilitySimulator(StaticData.EngineManager);
                simulator.SimulateSameWindow(agent.WAgent.Actions);
            }
            else
            {
                MessageBox.Show("Max number of try is reached. Run the agent again.");
            }

            //});
            //t.Start();
        }
Exemplo n.º 2
0
        public static void TestPlayabilityFromLevelsFile(string path, bool isSaveImage)
        {
            //OpenFileDialog op = new OpenFileDialog();
            //op.Title = @"Choose levels file";
            String pathReader = path;
            //if (op.ShowDialog() == DialogResult.OK)
            //{
            //    pathReader = op.FileName;
            //}
            StreamReader sr           = new StreamReader(pathReader);
            StreamWriter sw           = new StreamWriter(@"ResultsPlayabilityCheck.txt", true);
            String       currentLevel = String.Empty;

            while ((currentLevel = sr.ReadLine()) != null)
            {
                LevelBuilder.CreateRestedLevel(currentLevel, true);
                RyseAgent agent = new RyseAgent(10);
                agent.IsSaveImage               = isSaveImage;
                agent.maxDepthArr               = 0;
                agent.prologTime                = 0;
                agent.nodesExplored             = 0;
                agent.bestClosestFrogCookieDist = Double.MaxValue;
                agent.bestPerformedActions      = new List <Action>();
                agent.Simulator = new PlayabilitySimulatorEngineProlog(agent.IsSaveImage);
                bool           playability      = false;
                List <Action>  performedActions = new List <Action>();
                List <Vector3> performedVel     = new List <Vector3>();

                DateTime   d1   = DateTime.Now;
                ActionNode node = new ActionNode(new VoidAction());
                agent.SimulatePlayability(node, StaticData.EngineManager, ref playability, 0, performedActions, performedVel, 0, PlayabilityCheckMode.NormalCheck);
                DateTime d2 = DateTime.Now;
                agent.totalTime = (int)((d2 - d1).TotalSeconds);

                // Write to file

                sw.WriteLine(playability
                             + "\t" + agent.prologTime / 1000
                             + "\t" + agent.totalTime
                             + "\t" + String.Format("{0:0.00}", agent.bestClosestFrogCookieDist)
                             + "\t" + agent.maxDepthArr
                             + "\t" + agent.nodesExplored
                             + "\t" + currentLevel
                             + "\t" + HelperModules.GenericHelperModule.GetActionsString(agent.bestPerformedActions)
                             );
                Console.WriteLine(playability);
                // write to db
                //DatabaseHandler.InsertToPlayabilityTestTable(1,
                //                                             playability,
                //                                             prologTime / 1000,
                //                                             totalTime,
                //                                             String.Format("{0:0.00}", bestClosestFrogCookieDist),
                //                                             maxDepthArr,
                //                                             nodesExplored,
                //                                             _strLevel,
                //                                             HelperModules.GenericHelperModule.GetActionsString(bestPerformedActions));
                sw.Flush();
            }
            sw.Close();
        }
Exemplo n.º 3
0
 private void bCheckPlayabilty_Click(object sender, EventArgs e)
 {
     try
     {
         RYSEGenManager.SimulatePlayabiltityFromDesigner();
         SaveEngineState();
         try
         {
             if (DesignEnhanceManager.PlayabilityActions != String.Empty)
             {
                 LevelBuilder.CreateRestedLevel(DesignEnhanceManager.GevaLevel, false);
                 //RYSEManager manager = new RYSEManager(10);
                 //manager.IsSaveImage = false;
                 StaticData.GameSessionMode = SessionMode.PlayingMode;
                 //EngineShotsManager.ShowXNAWindow();
                 LivePlayabilitySimulator simulator = new LivePlayabilitySimulator(StaticData.EngineManager);
                 simulator.SimulateSameWindow(new ActionsGenerator(DesignEnhanceManager.PlayabilityActions).Actions);
             }
         }
         catch (Exception)
         {
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 4
0
        public static void GenerateStatesFilesPlayabilityFromLevelsActionsFiles()
        {
            //            string path = "160LevelSameCompsPlayable.txt";
            string       path = "PhysicsEngine_EvolvePlayActions - BadRemoved.txt";
            StreamReader sr   = new StreamReader(path);
            string       line = String.Empty;

            while ((line = sr.ReadLine()) != null)
            {
                LevelBuilder.CreateRestedLevel(line.Split('\t')[12], false);

                StaticData.GameSessionMode          = SessionMode.PlayingMode;
                ActionsExecuterGenSim.ListOfActions = new ActionsGenerator(line.Split('\t')[13]).Actions;
                ActionsExecuterGenSim.IsSimulatingGamePlayability = true;
                ActionsExecuterGenSim.nextActionIndex             = 0;
                ActionsExecuterGenSim.isFinished        = false;
                ActionsExecuterGenSim.IsSaveStateToFile = true;
                ActionsExecuterGenSim.IsSaveImage       = true;
                // 1300: arbitrary choice above the 80 max actions
                var gameTime = new GameTime();
                for (int i = 0; i < 1300; i++)
                {
                    ActionsExecuterGenSim.ManipulateActions(gameTime);
                    StaticData.EngineManager.Update(gameTime);
                }
                FilesCounter++;
            }
            sr.Close();
        }
Exemplo n.º 5
0
        private static void SimulateOnWindow(GenSimAgent agent)
        {
            LevelBuilder.CreateRestedLevel(agent.LevelStr, false);
            StaticData.GameSessionMode = SessionMode.PlayingMode;
            LivePlayabilitySimulator simulator = new LivePlayabilitySimulator(StaticData.EngineManager);

            simulator.SimulateNewWindow(agent.Actions, false, false);
        }
Exemplo n.º 6
0
 public static void EnhanceDesign(bool gammarsSetByUser)
 {
     if (!gammarsSetByUser)
     {
         String strGrammar = String.Empty;
         strGrammar = StaticData.EngineManager.PrefCompsManager.GetPrefCompsToGrammarFile();
         StreamWriter sw = new StreamWriter(FileGrammarPath);
         sw.Write(strGrammar);
         sw.Flush();
         sw.Close();
     }
     if (StaticData.CtrLevelDesigner.rbPCNone.Checked ||
         (
             (StaticData.CtrLevelDesigner.rbPCNone.Checked == false &&
              StaticData.CtrLevelDesigner.rbPCNormalCheck.Checked == false) &&
             StaticData.CtrLevelDesigner.rbPCRandom.Checked == false
         )
         )
     {
         GenericHelperModule.RunJavaProcess(@"C:\CTREngine\AuthoringToolEngineGEVAOnly.jar");
         StreamReader sr = new StreamReader(@"C:\CTREngine\EvolvedLevel.txt");
         GevaLevel          = sr.ReadToEnd().Split('\n')[0];
         PlayabilityActions = String.Empty;
         sr.Close();
     }
     else
     {
         if (StaticData.CtrLevelDesigner.rbPCNormalCheck.Checked)
         {
             GenericHelperModule.RunJavaProcess(
                 @"C:\CTREngine\AuthoringToolEngineWithNormalPlayFitness.jar");
         }
         else
         {
             if (StaticData.CtrLevelDesigner.rbPCRandom.Checked)
             {
                 GenericHelperModule.RunJavaProcess(
                     @"C:\CTREngine\AuthoringToolEngineWithRandomPlayFitness.jar");
             }
         }
         StreamReader sr =
             new StreamReader(@"C:\CTREngine\PhysicsEngine_EvolvePlayActions.txt");
         String line = sr.ReadToEnd();
         GevaLevel          = line.Split('\t')[13];
         PlayabilityActions = line.Split('\t')[14];
         if (line.Split('\t')[1].ToLower() == "true")
         {
             MessageBox.Show(
                 @"Playability-check is finished. The engine has found a playable level.");
         }
         sr.Close();
     }
     LevelBuilder.CreateRestedLevel(DesignEnhanceManager.GevaLevel, false);
     StaticData.ManipulationGameMode = ManipulationGameMode.NeutralMode;
     StaticData.GameSessionMode      = SessionMode.DesignMode;
 }
Exemplo n.º 7
0
        private void bOk_Click(object sender, EventArgs e)
        {
            string levelStr = tbxLevelString.Text;

            LevelBuilder.CreateRestedLevel(levelStr, false);
            //StaticData.EngineManager = new EngineManager(StaticData.EngineManager.Game1);
            //var LevelGeneratorEngine = new LevelGenerator(levelStr);
            //LevelGeneratorEngine.GenerateLevel();
            this.Close();
        }
Exemplo n.º 8
0
        private void bGenerateSamples_Click(object sender, EventArgs e)
        {
            GenericHelperModule.RunJavaProcess(@"C:\CTREngine\AuthoringToolEngineGEVAOnly.jar");
            StreamReader sr        = new StreamReader(@"C:\CTREngine\EvolvedLevel.txt");
            String       gevaLevel = sr.ReadToEnd().Split('\n')[0];

            sr.Close();
            LevelBuilder.CreateRestedLevel(gevaLevel, false);
            StaticData.ManipulationGameMode = ManipulationGameMode.NeutralMode;
            StaticData.GameSessionMode      = SessionMode.DesignMode;
        }
Exemplo n.º 9
0
        private void Init()
        {
            CompsScatteredSoFar  = 0;
            OverlappedComponents = 0;
            UpdateActionsIds     = new List <UpdateActionPair>();
            //CookieFrogMinDist = Int32.MaxValue;
            ActionsSoFar     = 0;
            _rand            = new Random(DateTime.Now.Millisecond);
            _placedCompSoFar = new List <Vector2>();
            //this.CATPairs[3].KeyTime = 412;
            //CATPairs[2].KeyTime = 367;
            IsPathIntersection = false;
            _ropeId            = 0;
            _bubbleId          = 0;
            IsSuccess          = false;
            Simulator          = new PlayabilitySimulatorEngineProlog(false);
            Actions            = new List <Action>();

            _rand = new Random(DateTime.Now.Millisecond);
            InitializeRanges();
            _nextCTP = CATPairs[0];

            String[] args = new String[2];

            String ropesStr = String.Empty;

            if (_isRopesRandomized)
            {
                ropesStr = GenerateRopesString();
            }
            else
            {
                ropesStr = GenerateRopesStringFromCatPairs();
            }

            LevelStr = "cookie(200, 300)" + ropesStr;
            args[1]  = LevelStr;

            LevelBuilder.CreateRestedLevel(LevelStr, false);
            AddCandyPlacement();
            if (IsTesting)
            {
                Shotter.TakeEngineShot(false);
            }
        }
Exemplo n.º 10
0
        public static void WatchLivePlayabilityGenSimLevels()
        {
            //for (int i = 3; i < 6; i++)
            //{
            string       path = @"C:\CTREngine\GenSimLevelsPlayable.txt";// "LevelsActions.txt";
            StreamReader sr   = new StreamReader(path);
            string       line = String.Empty;

            while ((line = sr.ReadLine()) != null)
            {
                LevelBuilder.CreateRestedLevel(line.Split('\t')[5], false);


                //EngineShotsManager.ShowXNAWindow();
                ActionsExecuterGenSim.RyseFreq = false;
                LivePlayabilitySimulator simulator = new LivePlayabilitySimulator(StaticData.EngineManager);
                simulator.SimulateNewWindow(new ActionsGenerator(line.Split('\t')[7]).Actions);
            }
            sr.Close();
            //}
        }
Exemplo n.º 11
0
        public static void WatchLivePlayabilityFromLevelsActionsFiles()
        {
            //for (int i = 3; i < 6; i++)
            //{
            string       path = "160LevelSameCompsPlayable.txt";// "LevelsActions.txt";
            StreamReader sr   = new StreamReader(path);
            string       line = String.Empty;

            while ((line = sr.ReadLine()) != null)
            {
                LevelBuilder.CreateRestedLevel(line.Split('\t')[12], false);
                RyseAgent agent = new RyseAgent(10);
                agent.IsSaveImage = false;

                StaticData.GameSessionMode = SessionMode.PlayingMode;
                //EngineShotsManager.ShowXNAWindow();
                LivePlayabilitySimulator simulator = new LivePlayabilitySimulator(StaticData.EngineManager);
                simulator.SimulateNewWindow(new ActionsGenerator(line.Split('\t')[13]).Actions);
            }
            sr.Close();
            //}
        }
Exemplo n.º 12
0
        public static void WatchLivePlayabilityFromLevelsActionsFilesAllCompsForDesigner(int levelNr)
        {
            string       path    = @"C:\CTREngine\100 Playability PPr.txt";
            StreamReader sr      = new StreamReader(path);
            string       line    = String.Empty;
            int          counter = 0;

            while ((line = sr.ReadLine()) != null)
            {
                if (counter == levelNr)
                {
                    DesignEnhanceManager.GevaLevel          = line.Split('\t')[12];
                    DesignEnhanceManager.PlayabilityActions = line.Split('\t')[13];
                    LevelBuilder.CreateRestedLevel(DesignEnhanceManager.GevaLevel, false);
                    RyseAgent agent = new RyseAgent(10);
                    agent.IsSaveImage = false;
                    StaticData.SetEngineManagerLastLevel(ObjectSerializer.DeepCopy(StaticData.EngineManager));
                    break;
                }
                counter++;
            }
            sr.Close();
        }
Exemplo n.º 13
0
        //"cookie( 300 , 120 ) frog( 360 , 300 )  rope( 550 , 50 , 100 ) rope( 440 , 50 , 180 ) blower( 490 , 180 , 4 )";
        //"cookie(405, 130)  frog(320, 70)  rope(0, 326, 116, 100)  rope(1, 705, 149, 180)  rocket(672, 351, 5) bump(300, 150, 1) bump(300, 200, 1) bump(300, 250, 1)  bump(300, 300, 1)";

        //"cookie(405, 130)  frog(400, 418)  rope(0, 326, 116, 100)  rope(1, 705, 149, 180)  bubble(7, 672, 351) rocket(720, 60, 3) bump(300, 150, 1) bump(300, 200, 1) bump(300, 250, 1)  bump(300, 300, 1)";
        //"cookie(405, 130)  frog(450, 450)  rope(1, 705, 149, 180)  rocket(672, 351, 5) bump(300, 150, 1) bump(300, 200, 1) bump(300, 250, 1)  bump(300, 300, 1)";

        //"cookie(471, 99)  frog(336, 426)  rope(0, 315, 44, 60)  rope(1, 455, 43, 100)  rope(2, 690, 31, 170)  blower(680, 400, 4)  bubble(0, 600, 320)  rocket(458, 262, 3)  bump(715, 165, 2)  bump(714, 236, 2)  bump(475, 206, 0)  bump(409, 207, 0)  bump(339, 207, 0)  bump(502, 381, 5)  bump(526, 442, 2) bump(526, 520, 2)";
        //"cookie(471, 99)  frog(336, 426)  rope(2, 620, 31, 170)  blower(650, 400, 4)  bubble(0, 600, 320)  rocket(458, 262, 3)  bump(715, 165, 2)  bump(714, 236, 2)  bump(475, 206, 0)  bump(409, 207, 0)  bump(339, 207, 0)  bump(502, 381, 5)  bump(526, 442, 2) bump(526, 520, 2)";

        //"cookie(471, 99)  frog(336, 426)  rope(2, 620, 31, 170)  blower(650, 350, 4)  bubble(0, 600, 320)  rocket(458, 262, 3)  bump(715, 165, 2)  bump(714, 236, 2)  bump(475, 206, 0)  bump(409, 207, 0)  bump(339, 207, 0)  bump(502, 381, 5)  bump(526, 442, 2) bump(526, 500, 2)";

        //"cookie(700, 239)  frog(356, 408)  rope(0, 706, 103, 180)  blower(746, 232, 4)  bubble(0, 597, 240)  rocket(600, 64, 3) bump(536, 210, 2)  bump(536, 270, 2) bump(536, 339, 2)  bump(537, 408, 2)  bump(537, 478, 2)  ";

        public static void GenerateLevelTesting()
        {
            LevelBuilder.CreateRestedLevel(StrLevelTesting, false);
            String str          = EngineStateManager.GetEngineStateFactStringWithEnterDelimiterToProlog();
            bool   IsDesign     = false;
            bool   isSaveToFile = true;

            if (!IsDesign)
            {
                ActionsExecuterGenSim.IsSaveStateToFile = true;
                RyseAgent agent = new RyseAgent(0);
                agent.IsSaveImage = false;
                agent.Simulator   = new PlayabilitySimulatorEngineProlog(agent.IsSaveImage);
                bool           playability      = false;
                List <Action>  performedActions = new List <Action>();
                List <Vector3> performedVel     = new List <Vector3>();
                EngineManager  engine           = ObjectSerializer.DeepCopy(StaticData.EngineManager);
                DateTime       d1       = DateTime.Now;
                ActionNode     baseNode = new ActionNode(null);
                agent.SimulatePlayability(baseNode, StaticData.EngineManager, ref playability, 0, performedActions, performedVel, 0, PlayabilityCheckMode.NormalCheck);
                DateTime d2 = DateTime.Now;
                agent.totalTime = (int)(d2 - d1).TotalSeconds;
                int avgLevels = 0;
                if (agent.NrOfTerminates > 0)
                {
                    avgLevels = (int)(agent.TerminateLevelSum / agent.NrOfTerminates);
                }
                int nrOfNonVoids =
                    agent.bestPerformedActions.FindAll(delegate(Action a) { return(!(a is VoidAction)); }).Count;
                //FilesHelperModule.PrintTreeToFile(baseNode);
                MessageBox.Show("The level is " + (playability ? "PLAYABLE" : "NOT PLAYABLE") + Environment.NewLine
                                + "Finished processing in = " + agent.totalTime.ToString() + " sec." +
                                Environment.NewLine
                                + "Nodes explored = " + agent.nodesExplored + Environment.NewLine
                                + "Nr of tree cuts = " + agent.NrOfTerminates + Environment.NewLine
                                + "Average tree depth cut = " + avgLevels + Environment.NewLine
                                + "Solution tree depth = " + agent.bestPerformedActions.Count + Environment.NewLine
                                + "Best distance = " + agent.Simulator.ClosestCookieFrogDistance + Environment.NewLine
                                + "Best Performed Actions are = " +
                                HelperModules.GenericHelperModule.GetActionsString(agent.bestPerformedActions) +
                                Environment.NewLine);

                if (isSaveToFile)
                {
                    string strFile = "0"
                                     + "\t" + playability
                                     + "\t" + agent.prologTime / 1000
                                     + "\t" + agent.totalTime
                                     + "\t" + String.Format("{0:0.00}", agent.bestClosestFrogCookieDist)
                                     + "\t" + agent.maxDepthArr
                                     + "\t" + agent.NrOfTerminates
                                     + "\t" + avgLevels
                                     + "\t" + agent.NrLevelterminatesStdMin
                                     + "\t" + agent.NrLevelterminatesStdMax
                                     + "\t" + agent.nodesExplored
                                     + "\t" + agent.bestPerformedActions.Count
                                     + "\t" + nrOfNonVoids
                                     + "\t" + StrLevelTesting
                                     + "\t" +
                                     HelperModules.GenericHelperModule.GetActionsString(agent.bestPerformedActions)
                                     + "\t" + HelperModules.GenericHelperModule.GetVector3ListString(performedVel);

                    StreamWriter sw = new StreamWriter(@"C:\CTREngine\LevelsTestTemp.txt");
                    sw.WriteLine(strFile);
                    sw.Flush();
                    sw.Close();
                }
                StaticData.GameSessionMode = SessionMode.PlayingMode;
                if (!IsDesign)
                {
                    if (playability)
                    {
                        LivePlayabilitySimulator liveSim = new LivePlayabilitySimulator(engine);
                        liveSim.SimulateNewWindow(performedActions);
                    }
                }
            }
        }
Exemplo n.º 14
0
        public static void GenerateGevaLevelRandPlayabilityFF(String[] args, bool isPrintPositionOnly, bool isSaveImage, int voidInitPlayTotalCount)
        {
            StaticData.EngineManager = null;
            LevelBuilder.CreateRestedLevel(args[1], true);
            RyseAgent agent = new RyseAgent(voidInitPlayTotalCount);

            agent.IsPrintPositionOnly = isPrintPositionOnly;
            agent.IsSaveImage         = isSaveImage;
            agent.Simulator           = new PlayabilitySimulatorEngineProlog(isSaveImage);
            bool           playability      = false;
            EngineManager  engine           = ObjectSerializer.DeepCopy(StaticData.EngineManager);
            DateTime       d1               = DateTime.Now;
            List <Action>  performedActions = new List <Action>();
            List <Vector3> performedVel     = new List <Vector3>();
            double         closestDistSoFar = Double.MaxValue;

            for (int j = 0; j < 10; j++)
            {
                if (!playability)
                {
                    performedActions         = new List <Action>();
                    StaticData.EngineManager = engine;
                    ActionNode node = new ActionNode(new VoidAction());
                    agent.SimulatePlayability(node, StaticData.EngineManager, ref playability, 0, performedActions, performedVel, 0, PlayabilityCheckMode.RandomCheck);
                    if (agent.bestClosestFrogCookieDist < closestDistSoFar)
                    {
                        closestDistSoFar = agent.bestClosestFrogCookieDist;
                    }
                    if (performedActions.Count <= 3)
                    {
                        closestDistSoFar = 70;
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            DateTime d2 = DateTime.Now;

            agent.totalTime = (int)((d2 - d1).TotalMilliseconds);
            StreamWriter swGEVA = new StreamWriter(@"C:\CTREngine\PlayabilityVal_ZGTREngine.txt");

            swGEVA.WriteLine(closestDistSoFar);
            swGEVA.Close();

            int avgLevels = 0;

            if (agent.NrOfTerminates > 0)
            {
                avgLevels = (int)(agent.TerminateLevelSum / agent.NrOfTerminates);
            }
            int nrOfNonVoids =
                agent.bestPerformedActions.FindAll(delegate(Action a) { return(!(a is VoidAction)); }).Count;
            String strFile = "1"
                             + "\t" + playability
                             + "\t" + agent.prologTime / 1000
                             + "\t" + agent.totalTime
                             + "\t" + String.Format("{0:0.00}", agent.bestClosestFrogCookieDist)
                             + "\t" + agent.maxDepthArr
                             + "\t" + agent.NrOfTerminates
                             + "\t" + avgLevels
                             + "\t" + agent.NrLevelterminatesStdMin
                             + "\t" + agent.NrLevelterminatesStdMax
                             + "\t" + agent.nodesExplored
                             + "\t" + agent.bestPerformedActions.Count
                             + "\t" + nrOfNonVoids
                             + "\t" + args[1]
                             + "\t" + HelperModules.GenericHelperModule.GetActionsString(agent.bestPerformedActions)
                             + "\t" + HelperModules.GenericHelperModule.GetVector3ListString(performedVel);

            if (closestDistSoFar <= 50)
            {
                StreamWriter sw = new StreamWriter(@"C:\CTREngine\PhysicsEngine_EvolvePlayActions.txt", true);
                sw.WriteLine(strFile);
                sw.Flush();
                sw.Close();
            }
            {
                StreamWriter sw = new StreamWriter(@"C:\CTREngine\PhysicsEngine_EvolvePlayActionsAllLevels.txt", true);
                sw.WriteLine(strFile);
                sw.Flush();
                sw.Close();
            }
        }
Exemplo n.º 15
0
        public static void ExtractComponentToActionExperiment()
        {
            string       path = "100 Playability PPr.txt";
            StreamReader sr   = new StreamReader(path);
            StreamWriter sw   = new StreamWriter("ComponentToActionExperiment.txt");
            string       line = String.Empty;

            while ((line = sr.ReadLine()) != null)
            {
                String levelStr   = line.Split('\t')[12];
                String actionsStr = line.Split('\t')[13];

                LevelBuilder.CreateRestedLevel(levelStr, false);
                StaticData.GameSessionMode          = SessionMode.PlayingMode;
                ActionsExecuterGenSim.ListOfActions = new ActionsGenerator(actionsStr).Actions;
                ActionsExecuterGenSim.IsSimulatingGamePlayability = true;
                ActionsExecuterGenSim.nextActionIndex             = 0;
                ActionsExecuterGenSim.isFinished        = false;
                ActionsExecuterGenSim.IsSaveStateToFile = false;
                if (false)
                {
                    EngineShotsManager.ShowXNAWindow();
                }
                var gameTime = new GameTime();
                for (int i = 0; i < 1300; i++)
                {
                    ActionsExecuterGenSim.ManipulateActions(gameTime);
                    StaticData.EngineManager.Update(gameTime);
                }

                List <Component> items = new LevelGenerator(levelStr).Items;
                items.RemoveAt(0);
                items.RemoveAt(0);
                List <Action> actions      = ActionsExecuterGenSim.ListOfActions;
                int           nrOfNonVoids = actions.FindAll(a => !(a is VoidAction)).Count;
                actions = actions.FindAll(a => !(a is VoidAction)).ToList();

                RyseUsageManager usageManager = new RyseUsageManager(items, actions);
                StaticData.RyseComponentsUsageHelper = usageManager;
                usageManager.DoAnalysis();

                int nrOfBumps   = items.FindAll(item => (item is Bump)).Count;
                int nrOfRockets = items.FindAll(item => (item is Rocket)).Count;
                int nrOfRopes   = items.FindAll(item => (item is Rope)).Count;
                int nrOfBubbles = items.FindAll(item => (item is Bubble)).Count;
                int nrOfBlowers = items.FindAll(item => (item is Blower)).Count;

                int nrOfUsedComps = usageManager.UsedRopes
                                    + usageManager.UsedRocket
                                    + usageManager.UsedBlowers
                                    + usageManager.UsedBubbles
                                    + usageManager.UsedBumps;

                int    nrONonfUsedComps         = items.Count - nrOfUsedComps;
                double actionsToComponentsRatio = (nrOfUsedComps) / (double)items.Count;

                sw.WriteLine(items.Count
                             + "\t" + (nrOfNonVoids + usageManager.UsedBumps)
                             + "\t" + nrOfUsedComps
                             + "\t" + nrONonfUsedComps
                             + "\t" + actionsToComponentsRatio

                             + "\t" + usageManager.UsedRopes
                             + "\t" + usageManager.UsedRocket
                             + "\t" + usageManager.UsedBlowers
                             + "\t" + usageManager.UsedBubbles
                             + "\t" + usageManager.UsedBumps

                             + "\t" + nrOfRopes
                             + "\t" + nrOfRockets
                             + "\t" + nrOfBlowers
                             + "\t" + nrOfBubbles
                             + "\t" + nrOfBumps

                             + "\t" + usageManager.UsedRopes / (double)nrOfRopes
                             + "\t" + usageManager.UsedRocket / (double)nrOfRockets
                             + "\t" + usageManager.UsedBlowers / (double)nrOfBlowers
                             + "\t" + usageManager.UsedBubbles / (double)nrOfBubbles
                             + "\t" + usageManager.UsedBumps / (double)nrOfBumps);
                sw.Flush();
            }
            sr.Close();
        }