Exemplo n.º 1
0
        private static void PrintDataToFiles(DateTime d1, DateTime d2, DateTime d3,
                                             EntraResult res, int fitness, String[] args, float usageFit, int usedNoRopes, int generatedNoRopes)
        {
            int t1 = (int)(d2 - d1).TotalMilliseconds;
            int t2 = (int)(d3 - d2).TotalMilliseconds;

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

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


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

            swGEVA.WriteLine(fitness);
            swGEVA.Close();
        }
Exemplo n.º 2
0
        public static Bitmap GetPolyOnlyBitmap(EntraResult result)
        {
            EntraDrawer drawer = new EntraDrawer(result.ReachableSpace, result.Frog,
                                                 result.FrogCompsInter);

            return(drawer.GetPolyOnlySolutionBitmap());
        }
Exemplo n.º 3
0
        public static void SetFitnessValueForLevel(String[] args)
        {
            GenManager.GenerateGevaLevel(args, null);
            EntraAgentSimple entraAgentSimple = new EntraAgentSimple();
            DateTime         d1      = DateTime.Now;
            float            fitness = 0;


            // Shortcut
            Vector2     cPos = StaticData.EngineManager.CookieRB.PositionXNACenter2D;
            Vector2     fPos = StaticData.EngineManager.FrogRB.PositionXNACenter2D;
            EntraResult res  = null;

            if ((cPos - fPos).Length() < 125)
            {
                fitness = 1000;
            }
            else
            {
                res = entraAgentSimple.CheckPlayability(StaticData.EngineManager);
                if (res.IsPlayable)
                {
                    fitness = 0;
                }
                else
                {
                    fitness = res.MinDistToFrog;
                }
            }
            DateTime d2 = DateTime.Now;


            bool isPlayable = false;

            if (res != null)
            {
                isPlayable = res.IsPlayable;
            }
            else
            {
                isPlayable = false;
            }

            string strFile = "0"
                             + "\t" + isPlayable
                             + "\t" + (d2 - d1).TotalMilliseconds
                             + "\t" + String.Format("{0:0.00}", fitness)
                             + "\t" + args[1];

            if (isPlayable)
            {
                StreamWriter sw = new StreamWriter(@"C:\CTREngine\EntraGenPlayableLevels.txt", true);
                sw.WriteLine(strFile);
                sw.Flush();
                sw.Close();
            }
            else
            {
                StreamWriter sw = new StreamWriter(@"C:\CTREngine\EntraGenNonPlayableLevels.txt", true);
                sw.WriteLine(strFile);
                sw.Flush();
                sw.Close();
            }

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

            swGEVA.WriteLine(fitness);
            swGEVA.Close();
        }