public void UpdateTest()
    {
        var config = _handler.ReadConfig(2);

        config.RunName = "Altered";
        config.MatchConfig.InitialRange++;
        config.MutationConfig.GenomeLength++;
        config.BrConfig.NumberOfCombatants++;
        config.MatchConfig.MinimumLocationRandomisation++;
        config.MatchConfig.MaximumLocationRandomisation++;
        config.BrConfig.SurvivalBonus++;
        config.RaceConfig.RaceMaxDistance++;
        config.RaceConfig.RaceScoreMultiplier++;
        config.BrConfig.DeathScoreMultiplier++;
        config.RaceConfig.RaceGoalObject++;

        _handler.UpdateExistingEvolutionConfig(config);

        var updated = _handler.ReadConfig(2);

        Assert.AreEqual(config.RunName, updated.RunName);
        Assert.AreEqual("Altered", updated.RunName);
        Assert.AreEqual(config.MatchConfig.InitialRange, updated.MatchConfig.InitialRange);
        Assert.AreEqual(config.MutationConfig.GenomeLength, updated.MutationConfig.GenomeLength);
        Assert.AreEqual(config.BrConfig.NumberOfCombatants, updated.BrConfig.NumberOfCombatants);
        Assert.AreEqual(config.MatchConfig.MinimumLocationRandomisation, updated.MatchConfig.MinimumLocationRandomisation);
        Assert.AreEqual(config.MatchConfig.MaximumLocationRandomisation, updated.MatchConfig.MaximumLocationRandomisation);
        Assert.AreEqual(config.BrConfig.SurvivalBonus, updated.BrConfig.SurvivalBonus);
        Assert.AreEqual(config.RaceConfig.RaceMaxDistance, updated.RaceConfig.RaceMaxDistance);
        Assert.AreEqual(config.RaceConfig.RaceScoreMultiplier, updated.RaceConfig.RaceScoreMultiplier);
        Assert.AreEqual(config.BrConfig.DeathScoreMultiplier, updated.BrConfig.DeathScoreMultiplier);
        Assert.AreEqual(config.RaceConfig.RaceGoalObject, updated.RaceConfig.RaceGoalObject);
    }
예제 #2
0
    public void UpdateTest()
    {
        var config = _handler.ReadConfig(0);

        config.RunName = "Altered";
        config.MatchConfig.AllowedModulesString = "1,3,5";
        config.MatchConfig.InitialRange++;
        config.MatchConfig.Budget++;
        config.MutationConfig.GenomeLength++;
        config.MatchConfig.MinimumLocationRandomisation++;
        config.MatchConfig.MaximumLocationRandomisation++;
        config.EvolutionDroneConfig.DronesInSphereRandomRadius++;
        config.EvolutionDroneConfig.DronesOnSphereRandomRadius++;

        _handler.UpdateExistingEvolutionConfig(config);

        var updated = _handler.ReadConfig(0);

        Assert.AreEqual(config.RunName, updated.RunName);
        Assert.AreEqual("Altered", updated.RunName);
        Assert.AreEqual(config.MatchConfig.MinimumLocationRandomisation, updated.MatchConfig.MinimumLocationRandomisation);
        Assert.AreEqual(config.MatchConfig.MaximumLocationRandomisation, updated.MatchConfig.MaximumLocationRandomisation);
        Assert.AreEqual(config.EvolutionDroneConfig.DronesInSphereRandomRadius, updated.EvolutionDroneConfig.DronesInSphereRandomRadius);
        Assert.AreEqual(config.EvolutionDroneConfig.DronesOnSphereRandomRadius, updated.EvolutionDroneConfig.DronesOnSphereRandomRadius);

        Assert.AreEqual("1,3,5", updated.MatchConfig.AllowedModulesString);
        Assert.AreEqual(config.MatchConfig.Budget, updated.MatchConfig.Budget);
        Assert.AreEqual(config.MatchConfig.InitialRange, updated.MatchConfig.InitialRange);
        Assert.AreEqual(config.MutationConfig.GenomeLength, updated.MutationConfig.GenomeLength);
    }
예제 #3
0
        protected int SaveConfig()
        {
            var config = ReadControls();

            if (_hasLoadedExisting)
            {
                return(_handler.UpdateExistingEvolutionConfig(config));
            }
            else
            {
                return(_handler.SaveNewEvolutionConfig(config));
            }
        }