public Statistics(boolean[][] world)
  {
    W = world[0].length;
    H = world.length;
    worlds.add(world);
    maximumGrowthRate = 0.0;
    maximumDeathRate = 0.0;
    loopStart = 0;
    loopEnd = 0;
    int previousPopulation = countPopulation(world);
    int currentPopulation;
    maximumPopulation = previousPopulation;
    int ii = 1;
    boolean done = false;
    while (!done)
    {
      world = StatisticsLife.nextGeneration(world);
      currentPopulation = countPopulation(world);
      double growthRate = ((currentPopulation - previousPopulation)*1.0) / (previousPopulation*1.0);
      double deathRate = -growthRate;
      if (growthRate > maximumGrowthRate) maximumGrowthRate = growthRate;
      if (deathRate > maximumDeathRate) maximumDeathRate = deathRate;
      if (currentPopulation > maximumPopulation) maximumPopulation = currentPopulation;
      int ind = 0;
      for (boolean[][] x : worlds)
      {
        if (compare(x,world))
        {
          loopStart = ind;
          loopEnd = ii - 1;
          done = true;
          break;
        }
        ++ind;
      }
      worlds.add(world);
      ii++; 
      previousPopulation = currentPopulation;
    }
    if (!done) loopStart = -1; //no loops found
  }