예제 #1
0
        public ActionResult EvolveToEnd(EvolvePost data)
        {
            var evolution = DatabaseHelpers.GetEvolution(data.evolutionId);

            if (evolution != null)
            {
                evolution.EvolveToEnd(random);
                return(Json(evolution));
            }

            return(Json(new { Success = false }));
        }
예제 #2
0
        public ActionResult Evolve(EvolvePost data)
        {
            System.Diagnostics.Debug.WriteLine(data.evolutionId);
            System.Diagnostics.Debug.WriteLine(data);

            var evolution = DatabaseHelpers.GetEvolution(data.evolutionId);

            if (evolution != null)
            {
                evolution.Evolve(random);
                return(Json(evolution));
            }

            return(Json(new { Success = false }));
        }
예제 #3
0
        public ActionResult Evolution(string evolutionId = "")
        {
            var evolution = DatabaseHelpers.GetEvolution(evolutionId);

            if (evolution != null)
            {
                ViewBag.populationCount = evolution.Population.Count;
                ViewBag.variableCount   = evolution.VariableCount;
                ViewBag.valueCount      = evolution.ValueCount;
                ViewBag.evolution       = evolution;
                var probabilities = Math.Pow(evolution.ValueCount, evolution.VariableCount);
                var duration      = probabilities / (1000f * 60f * 60f * 24f * 365f);
                ViewBag.probabilities = probabilities;
                ViewBag.duration      = duration;
            }
            else
            {
                return(Redirect("Index"));
            }

            return(View());
        }