/** * DiseaseSimulation -- using the Simulation class **/ public class DiseaseSimulation extends Simulation { /** * lineForFile -- write out number of infected **/ public String lineForFile(){ PersonAgent first; first = (PersonAgent) agents.get(0); return (new Integer(first.infected())).toString(); } /** * Fill the world with 60 persons, one sick **/ public void setUp(){ // Let the world be set up //super.setUp(); // Or set it up with a smaller world world = new World(300,300); world.setAutoRepaint(false); PersonAgent moi; // 60 people for (int num = 0; num < 60; num++) { moi = new PersonAgent(world,this); } // Infect the first one moi = (PersonAgent) getAgents().get(0); moi.infect(); } }