예제 #1
0
        public override GeneticFunction Clone()
        {
            GeneticFunction result = new SubtractFunction();

            result.modifier = modifier;
            return(result);
        }
 public static GeneticFunction GetGene()
 {
     GeneticFunction result = null;
     int r = GeneticPrimes.rnd.Next(7);
     switch (r)
     {
         case 0:
             result = new AddFunction();
             break;
         case 1:
             result = new SubtractFunction();
             break;
         case 2:
             result = new MultiplyFunction();
             break;
         case 3:
             result = new DivideFunction();
             break;
         case 4:
             result = new OddFunction();
             break;
         case 5:
             result = new SquareRootFunction();
             break;
         case 6:
             result = new SquareFunction();
             break;
     }
     result.modifier = GeneticPrimes.rnd.Next(rndRange);
     return result;
 }
예제 #3
0
        public static GeneticFunction GetGene()
        {
            GeneticFunction result = null;
            int             r      = GeneticPrimes.rnd.Next(7);

            switch (r)
            {
            case 0:
                result = new AddFunction();
                break;

            case 1:
                result = new SubtractFunction();
                break;

            case 2:
                result = new MultiplyFunction();
                break;

            case 3:
                result = new DivideFunction();
                break;

            case 4:
                result = new OddFunction();
                break;

            case 5:
                result = new SquareRootFunction();
                break;

            case 6:
                result = new SquareFunction();
                break;
            }
            result.modifier = GeneticPrimes.rnd.Next(rndRange);
            return(result);
        }
 public override GeneticFunction Clone()
 {
     GeneticFunction result = new SubtractFunction();
     result.modifier = modifier;
     return result;
 }