// Flocking // Daniel Shiffman // The Nature of Code, Spring 2009 // Flock class // Does very little, simply manages the ArrayList of all the boids class Flock { int colorNum = 0; ArrayList colorBoid; ArrayList rValue; ArrayList boids; // An arraylist for all the boids Flock() { boids = new ArrayList(); // Initialize the arraylist } void run() { rValue = new ArrayList(); // Initialize the arraylist colorBoid = new ArrayList(); for (int i = 0; i < boids.size(); i++) { Boid b = (Boid) boids.get(i); b.run(boids); // Passing the entire list of boids to each boid individually //println(b.getColor()); colorBoid.add(b.getColor()); rValue.add(b.rValue()); //println(colorBoid); } } void addBoid(Boid b) { boids.add(b); } int getBoidNum(){ return boids.size(); } /* int tellColor(){ for (int i = 0; i < colorBoid.size(); i++) { int colorboid = (Integer) colorBoid.get(i); //getColor(colorboid); return colorboid; } }*/ // return colorBoid; }