//mutateExpressionTree :: LeagueStatement -> Different LeagueStatement private LeagueStatement mutateExpressionTree(LeagueStatement expression, double mutationChance) { //this is the biggest sticking point in terms of generalizing the approach. How do you //generalize mutation?? double roll = GetRandomPercent(); List <LeagueStatement> newChildren = new List <LeagueStatement>(); foreach (LeagueStatement child in expression.getChildren()) { newChildren.Add(mutateExpressionTree(child, mutationChance)); } LeagueStatement newExpression = (LeagueStatement)expression.Clone(); newExpression.setChildren(newChildren.ToArray()); if (roll < mutationChance) //mutate! { newExpression = newExpression.mutate(); } return(newExpression); }
public Oracle(LeagueStatement prophecy) { this.prophecy = prophecy; }