kiarocks -- I am back!
age++; int actualAge = (age - (age % EpidemicWorld.ageRate) ) / EpidemicWorld.ageRate; // Computes actual age if (age % EpidemicWorld.ageRate == 0) // asking if is an actual birthday { switch (actualAge) { case 13: infectChance = 10; deathChance = 1; procreateChance = 2; break; case 18: infectChance = 15; deathChance = 5; procreateChance = 10; break; case 21: deathChance = 3; procreateChance = 15 - 5 * infectionLevel; break; case 26: procreateChance = 20 - 5 * infectionLevel; case 35: procreateChance = 5 - infectionLevel; case 50: procreateChance = 0; infectChance = 20; deathChance = 5; case 60: infectChance = 25; deathChance = 8; case 75: infectChance = 30; deathChance = 12; } }
int actualAge = (age - (age % EpidemicWorld.ageRate) ) / EpidemicWorld.ageRate;
public static final int ageRate = 5;
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.util.*; // (List) public class EpidemicWorld extends World { public static final int ageRate = 5; public EpidemicWorld() { super(25, 25, 25); populateWorld(); }
private void procreate(int procChance) { List<Person>persons = getObjectsInRange(2, Person.class); int maleCt = 0; for (Person person: persons) { if (person.sex == 1 && person.infectionStage < 2) { maleCt++; } } if (Greenfoot.getRandomNumber(100) < procChance * maleCt) { isPregnant = true; howLongTillDue = EpidemicWorld.ageRate * 3 / 4; } }