class Model { private int numberOfAgents = 3; private int numberOfIterations = 10; private Agent[] agents = new Agent[numberOfAgents]; private Environment world = new Environment(); public Model() { for (int i = 0; i < agents.length; i++) { // could also use numberOfAgents. agents[i] = new Agent(world); } for (int i = 0; i < world.getHeight(); i++) { for (int j = 0; j < world.getWidth(); j++) { world.setDataValue(j, i, 255.0); } } for (int i = 0; i < numberOfIterations; i++) { for (int j = 0; j < numberOfAgents; j++) { agents[j].run(); System.out.println("value at " + agents[j].getX() + " " + agents[j].getY() + " is " + world.getDataValue(agents[j].getX(), agents[j].getY())); } } } public static void main (String args[]) { new Model(); } }