public override Individual CreateIndividual(IRandomGenerator randomGenerator)
        {
            var ant = new ArtificialAnt(this, 0, StatesNumber, EventsNumber);

            for (int state = 0; state < StatesNumber; state++)
            {
                for (int @event = 0; @event < EventsNumber; @event++)
                {
                    ant.Transitions[state, @event] =
                        new FiniteAutomaton.StateTransition(randomGenerator.Next(StatesNumber), randomGenerator.Next(ant.OutputsNumber));
                }
            }

            return ant;
        }
        public override Individual CreateIndividual(IRandomGenerator randomGenerator)
        {
            var ant = new ArtificialAnt(this, 0, StatesNumber, EventsNumber);

            for (int state = 0; state < StatesNumber; state++)
            {
                for (int @event = 0; @event < EventsNumber; @event++)
                {
                    ant.Transitions[state, @event] =
                        new FiniteAutomaton.StateTransition(randomGenerator.Next(StatesNumber), randomGenerator.Next(ant.OutputsNumber));
                }
            }

            return(ant);
        }
        public double EvaluateIndividual(ArtificialAnt ant)
        {
            var mover = new AntMover(ant, AppleField);

            int apples = 0;
            int lastStep = 0;
            for (int i = 0; i < MaxStepsCount; ++i)
            {
                // Ate an apple
                if (mover.Move())
                {
                    apples++;
                    // In which steps ate, to determine the best in the case that both ate all the apples
                    lastStep = i;
                }
                if (apples == AppleField.FoodCount)
                    break;
            }

            return apples - 1.0 * lastStep / MaxStepsCount;
        }
        public double EvaluateIndividual(ArtificialAnt ant)
        {
            var mover = new AntMover(ant, AppleField);

            int apples   = 0;
            int lastStep = 0;

            for (int i = 0; i < MaxStepsCount; ++i)
            {
                // Ate an apple
                if (mover.Move())
                {
                    apples++;
                    // In which steps ate, to determine the best in the case that both ate all the apples
                    lastStep = i;
                }
                if (apples == AppleField.FoodCount)
                {
                    break;
                }
            }

            return(apples - 1.0 * lastStep / MaxStepsCount);
        }