public override void draw(Graphics g, CoordinateFrame scale)
        {
            if (collisionManager is GridCollision)
            {
                GridCollision gc = (GridCollision)collisionManager;
                gc.draw(g, scale);
            }


            if (environment != null)
            {
                environment.draw(g, scale);
            }

            foreach (Robot robot in robots)
            {
                robot.draw(g, scale);
            }
            double[] obj = null;

            instance_pack ip = new instance_pack();

            ip.robots           = robots;
            ip.env              = environment;
            ip.timeSteps        = this.timeSteps;
            ip.agentBrain       = agentBrain;
            ip.collisionManager = collisionManager;
            ip.elapsed          = this.elapsed;
            ip.ff       = this.fitnessFunction;
            ip.bc       = this.behaviorCharacterization;
            ip.timestep = timestep;

            g.DrawString("Fitness: " + this.fitnessFunction.calculate(this, this.environment, ip, out obj), new Font("Tahoma", 12), Brushes.Black, 10, 90);
            g.DrawString("Elapsed time: " + this.elapsed, new Font("Tahoma", 12), Brushes.Black, 10, 60);
        }
        protected void setupVariables()
        {
            robots = new List <Robot>();
            substrateDescription           = new SubstrateDescription(substrateDescriptionFilename);
            GenomeVisualizerForm.substrate = substrateDescription;

            agentBrain = new AgentBrain(homogeneousTeam, numberRobots, substrateDescription, genome != null ? genome.Decode(null) : null, normalizeWeights, adaptableANN, modulatoryANN, multibrain, evolveSubstrate);

            //if(homogeneousTeam)
            //Console.WriteLine("inc:"+agentBrain.getBrain(0).InputNeuronCount);

            loadEnvironments(this);

            //agentsCollide=environment.agentsCollide;
            //agentsVisible=environment.agentsVisible;

            //Substrate sensor density
            initializeRobots(agentBrain, environment, headingNoise, sensorNoise, effectorNoise, null);

            setFitnessFunction(fitnessFunctionName);
            setBehavioralCharacterization(behaviorCharacterizationName);


            if (gridCollision)
            {
                collisionManager = new GridCollision();
            }
            else
            {
                collisionManager = new StandardCollision();
            }
            collisionManager.Initialize(environment, this, this.robots);
            timeSteps = 0;
            elapsed   = 0;
        }
        protected void setupVariables()
        {
            //Console.WriteLine("setupVariables");
            robots = new List <Robot>();
            // Schrum: more special handling: Don't want to overwrite substrate in visual mode
            if (!(fitnessFunction is FourTasksFitness))
            {
                substrateDescription = new SubstrateDescription(substrateDescriptionFilename);
            }

            agentBrain = new AgentBrain(homogeneousTeam, numberRobots, substrateDescription, genome != null ? genome.Decode(null) : null, normalizeWeights, adaptableANN, modulatoryANN, multibrain, numBrains, evolveSubstrate, preferenceNeurons, forcedSituationalPolicyGeometry);

            //if(homogeneousTeam)
            //Console.WriteLine("inc:"+agentBrain.getBrain(0).InputNeuronCount);

            loadEnvironments(this);

            //agentsCollide=environment.agentsCollide;
            //agentsVisible=environment.agentsVisible;

            //Substrate sensor density
            initializeRobots(agentBrain, environment, headingNoise, sensorNoise, effectorNoise, null);

            // Schrum: more special handling: Don't want to overwrite fitness function in visual mode
            if (!(fitnessFunction is FourTasksFitness))
            {
                setFitnessFunction(fitnessFunctionName);
            }
            else // sufficient if FourTasks is already loaded
            {
                //Console.WriteLine("setupVariables: environmentName = " + environmentName);
                ((FourTasksFitness)fitnessFunction).setExperiment(this);
                fitnessFunction.reset();
                ((FourTasksFitness)fitnessFunction).setupFitness(FourTasksFitness.environmentID(environmentName));
            }
            setBehavioralCharacterization(behaviorCharacterizationName);


            if (gridCollision)
            {
                collisionManager = new GridCollision();
            }
            else
            {
                collisionManager = new StandardCollision();
            }
            collisionManager.Initialize(environment, this, this.robots);
            timeSteps = 0;
            elapsed   = 0;
        }
        protected void setupVariables()
        {
            robots = new List<Robot>();
            substrateDescription = new SubstrateDescription(substrateDescriptionFilename);

            agentBrain = new AgentBrain(homogeneousTeam, numberRobots, substrateDescription, genome != null ? genome.Decode(null) : null, normalizeWeights, adaptableANN, modulatoryANN, multibrain, evolveSubstrate, dirComm);

            //if(homogeneousTeam)
            //Console.WriteLine("inc:"+agentBrain.getBrain(0).InputNeuronCount);

            loadEnvironments(this);

            //agentsCollide=environment.agentsCollide;
            //agentsVisible=environment.agentsVisible;

            //Substrate sensor density
            initializeRobots(agentBrain, environment, headingNoise, sensorNoise, effectorNoise, null);

            setFitnessFunction(fitnessFunctionName);
            setBehavioralCharacterization(behaviorCharacterizationName);

            if (gridCollision)
                collisionManager = new GridCollision();
            else
                collisionManager = new StandardCollision();
            collisionManager.Initialize(environment, this, this.robots);
            timeSteps = 0;
            elapsed = 0;

            if (initialized)
                foreach (Prey p in environment.preys)
                {
                    p.reset();
                }
            preyCaught = 0;
        }