Пример #1
0
    public void TaskChanged()
    {
        var settings = LoadEvolutionSettings();

        settings.task = EvolutionTaskUtil.TaskFromString(taskDropdown.captionText.text);
        SaveEvolutionSettings(settings);
    }
Пример #2
0
    /// <summary>
    /// Returns the chosen task based on the value of the taskDropDown;
    /// </summary>
    public EvolutionTask GetTask()
    {
        var taskString = taskDropdown.captionText.text.ToUpper();
        var task       = EvolutionTaskUtil.TaskFromString(taskString);

        var settings = LoadEvolutionSettings();

        settings.task = task;
        SaveEvolutionSettings(settings);

        return(task);
    }
Пример #3
0
    public static EvolutionSettings Decode(string encoded)
    {
        var parts    = encoded.Split('#');
        var settings = new EvolutionSettings();

        settings.keepBestCreatures = bool.Parse(parts[1]);
        settings.simulationTime    = int.Parse(parts[2]);
        settings.populationSize    = int.Parse(parts[3]);
        settings.simulateInBatches = bool.Parse(parts[4]);
        settings.batchSize         = int.Parse(parts[5]);
        settings.task         = EvolutionTaskUtil.TaskFromString(parts[6]);
        settings.mutationRate = int.Parse(parts[7]);

        return(settings);
    }