anchor.diff:      Groups = misc_util:groupBy([{misc_util:behavior(A),A} || A <- Agents ]),
       NewGroups = [evolution:sendToWork(G) || G <- Groups],
       NewAgents = misc_util:shuffle(lists:flatten(NewGroups)),
  -    loop(NewAgents,FDs)
  -  end.+    NewCounters = countGroups(Groups,#counters{}),
  +    loop(NewAgents,FDs,#counters{fight = Counters#counters.fight + NewCounters#counters.fight,
  +                                reproduction = Counters#counters.reproduction + NewCounters#counters.reproduction,
  +                                death = Counters#counters.death + NewCounters#counters.death,
  +                                migration = Counters#counters.migration + NewCounters#counters.migration})
  +  end.
  +
  +-spec countGroups([tuple()],counters()) -> counters().
  +countGroups([],Counter) ->
  +  Counter;
  +countGroups([{death,AgentList}|Groups],Counter) ->
  +  countGroups(Groups,Counter#counters{death = length(AgentList)});
  +countGroups([{migration,AgentList}|Groups],Counter) ->
  +  countGroups(Groups,Counter#counters{migration = length(AgentList)});
  +countGroups([{fight,AgentList}|Groups],Counter) ->
  +  countGroups(Groups,Counter#counters{fight = length(AgentList)});
  +countGroups([{reproduction,AgentList}|Groups],Counter) ->
  +  countGroups(Groups,Counter#counters{reproduction = length(AgentList)}).
positive.code:   FDs = io_util:prepareWriting(IslandPath),
    Agents = genetic:generatePopulation(ProblemSize),
    timer:send_after(config:writeInterval(),{write,-99999}),
    loop(Agents,FDs).
  
  -spec close(pid()) -> {finish,pid()}.
  close(Pid) ->
  
negative.code:       io_util:write(dict:fetch(population,FDs),length(Agents)),
        io:format("Island ~p Fitness ~p Population ~p~n",[self(),misc_util:result(Agents),length(Agents)]),
        timer:send_after(config:writeInterval(),{write,Fitness}),
        loop(Agents,FDs,#counters{});
      {agent,_Pid,A} ->
        loop([A|Agents],FDs,Counters);
      {finish,_Pid} ->
        io_util:closeFiles(FDs),
        ok
  