Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            string saveDirectory     = @"c:\temp\DNA\upload";
            string imageDirectory    = @"c:\temp\DNA\evolution";
            var    DBContext         = new EvolutionEntities();
            var    mostRecentSuccess = DBContext.FamilyTrees.Where(x => x.WasSuccessful).OrderByDescending(x => x.Generation).First();

            var gifFilePath = GenerateGif(mostRecentSuccess.Generation, saveDirectory, imageDirectory, DBContext);
            var successIntervalsFilePath = SuccessIntervalGraph(mostRecentSuccess.Generation, saveDirectory, imageDirectory, DBContext);
            var scoresFilePath           = ScoreGraph(mostRecentSuccess.Generation, saveDirectory, imageDirectory, DBContext);
            var mostRecentFilePath       = GenerateMostRecent(mostRecentSuccess.Generation, mostRecentSuccess.Child, saveDirectory, imageDirectory);
            var indexFile = GenerateHTML(successIntervalsFilePath, scoresFilePath, gifFilePath, mostRecentFilePath, saveDirectory);

            //CalculatePixels();
            DBContext.Dispose();

            Console.WriteLine("done");
            //Console.ReadLine();
        }
Ejemplo n.º 2
0
        private void Log(bool successfulGeneration)
        {
            var DBContext = new EvolutionEntities();

            DBContext.FamilyTrees.Add(new FamilyTree()
            {
                Child         = Index,
                Generation    = _generation,
                LinesOfCode   = _programBody.Count,
                Score         = Score,
                WasSuccessful = successfulGeneration,
                RunTime       = runTime
            });
            try
            {
                DBContext.SaveChanges();
            }
            catch
            {
            }
            DBContext.Dispose();
        }