Ejemplo n.º 1
0
        //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);
        }
Ejemplo n.º 2
0
 public Oracle(LeagueStatement prophecy)
 {
     this.prophecy = prophecy;
 }