public void Mutate() { KnownSituation randomSituation = AllKnownSituations[Random.Range(0, AllKnownSituations.Count())]; KnownAction randomAction = AllKnownActions[Random.Range(0, AllKnownActions.Count())]; this.SituationMap[randomSituation] = randomAction; }
public static DNA CreateRandomDna() { DNA randomDna = new DNA(); randomDna.MaximumSpeed = Random.Range(1, 6); randomDna.ViewingDistance = Random.Range(1, 8); foreach (KnownSituation situation in AllKnownSituations) { KnownAction randomAction = AllKnownActions[Random.Range(0, AllKnownActions.Count())]; randomDna.SituationMap[situation] = randomAction; } return(randomDna); }