示例#1
0
        public static int SetFitnessValueForLevel(String[] args)
        {
            GenManager.GenerateGevaLevel(args, null);
            String levelStr = args[1];
            bool   isShortestPathOnlyComparsion = args[2] != "0";

            DateTime         d1 = DateTime.Now;
            EntraAgentSimple entraAgentSimple = new EntraAgentSimple();
            var res = entraAgentSimple.CheckPlayability(StaticData.EngineManager);

            DateTime d2               = DateTime.Now;
            int      fitness          = Int32.MaxValue;
            int      usedNoRopes      = -1;
            int      generatedNoRopes = -1;
            float    usageFit         = -1;

            if (res.IsPlayable)
            {
                List <List <PolyLog> > chosenPath;
                EntraPathAgent         pathAgent = new EntraPathAgent(entraAgentSimple);
                GetFitnessUsage(pathAgent.AllPaths, levelStr, isShortestPathOnlyComparsion, out usedNoRopes,
                                out generatedNoRopes, out usageFit);
                fitness = (int)(40 * 0 + 60 * usageFit);
            }
            else
            {
                fitness = (int)(40 * MathHelperModule.Normalize((int)res.MinDistToFrog, 200, 50) + 60);
            }

            DateTime d3 = DateTime.Now;

            PrintDataToFiles(d1, d2, d3, res, fitness, args, usageFit, usedNoRopes, generatedNoRopes);
            return(fitness);
        }
示例#2
0
        public static void SetFitnessValueForLevel(String[] args, List <Point> designerPath)
        {
            GenManager.GenerateGevaLevel(args, null);
            bool isOrdering = args[2] != "0";
            //EngineShotsManager shots = new EngineShotsManager();
            //shots.TakeEngineShot(false);
            DateTime d1 = DateTime.Now;

            EntraPlusGenManager.SetFitnessValueForLevel(args);

            EntraAgentSimple entraAgentSimple = new EntraAgentSimple();
            var res = entraAgentSimple.CheckPlayability(StaticData.EngineManager);

            DateTime d2      = DateTime.Now;
            int      fitness = Int32.MaxValue;

            if (res.IsPlayable)
            {
                EntraPathAgent pathAgent = new EntraPathAgent(entraAgentSimple);
                fitness = pathAgent.GetFitnessValue(designerPath, isOrdering);
            }
            else
            {
                fitness = 100;
                //40 * (int)MathHelperModule.Normalize((int)res.MinDistToFrog, 400, 0) + 60;
            }

            DateTime d3 = DateTime.Now;

            int t1 = (int)(d2 - d1).TotalMilliseconds;
            int t2 = (int)(d3 - d2).TotalMilliseconds;


            //if (res.IsPlayable)
            //PRINTING
            {
                string strFile = "0"
                                 + "\t" + res.IsPlayable
                                 + "\t" + fitness
                                 + "\t" + res.MinDistToFrog
                                 + "\t" + t1
                                 + "\t" + t2
                                 + "\t" + (t1 + t2)
                                 + "\t" + String.Format("{0:0.00}", fitness)
                                 + "\t" + args[1];

                StreamWriter sw = new StreamWriter(@"C:\CTREngine\AllEntraPathEvolvedLevels.txt", true);
                sw.WriteLine(strFile);
                sw.Flush();
                sw.Close();
            }


            StreamWriter swGEVA = new StreamWriter(@"C:\CTREngine\PlayabilityVal_ZGTREngine.txt");

            swGEVA.WriteLine(fitness);
            swGEVA.Close();
        }
示例#3
0
        public static void ShowTestResult(String[] args)
        {
            GenManager.GenerateGevaLevel(args, StaticData.EntraImageInput);

            //EngineShotsManager shots = new EngineShotsManager();
            //shots.TakeEngineShot(StaticData.EntraImageInput);

            EntraAgentSimple entraAgentSimple = new EntraAgentSimple();
            var res = entraAgentSimple.CheckPlayability(StaticData.EngineManager);

            EntraDrawer.DrawIntoFileTesting(res.ReachableSpace);

            EntraPathAgent pathAgent = new EntraPathAgent(entraAgentSimple);

            pathAgent.DrawPaths();
        }
示例#4
0
        public static void SetFitnessValueForLevelTest(String[] args, int counter)
        {
            GenManager.GenerateGevaLevel(args, null);
            String levelStr = args[1];
            bool   isShortestPathOnlyComparsion = args[2] != "0";

            DateTime         d1 = DateTime.Now;
            EntraAgentSimple entraAgentSimple = new EntraAgentSimple();
            var res = entraAgentSimple.CheckPlayability(StaticData.EngineManager);

            DateTime d2               = DateTime.Now;
            int      fitness          = Int32.MaxValue;
            int      usedNoRopes      = -1;
            int      generatedNoRopes = -1;
            float    usageFit         = -1;

            if (res.IsPlayable)
            {
                EntraPathAgent pathAgent = new EntraPathAgent(entraAgentSimple);
                GetFitnessUsage(pathAgent.AllPaths, levelStr, isShortestPathOnlyComparsion, out usedNoRopes,
                                out generatedNoRopes, out usageFit);
                fitness = (int)(40 * 0 + 60 * usageFit);

                EngineShotsManager shots = new EngineShotsManager();
                shots.TakeEngineShot(StaticData.EntraImageInput);
                pathAgent.DrawShortestPath(counter);
            }
            else
            {
                fitness = (int)(40 * MathHelperModule.Normalize((int)res.MinDistToFrog, 300, 50) + 60);
            }

            DateTime d3 = DateTime.Now;

            StreamWriter sw = new StreamWriter(@"PolysTesting\test.txt", true);

            sw.WriteLine(res.IsPlayable + "\t"
                         + fitness + "\t"
                         + usedNoRopes + "\t"
                         + generatedNoRopes + "\t"
                         + String.Format("{0:0.00}", usageFit));
            sw.Close();
            //PrintDataToFiles(d1, d2, d3, res, fitness, args);
        }