anchor.diff:                          Vertex = #vertex{name=Name} <- Vertices]),
       ets:insert(Ets, {tpos, 0}),
       ets:insert(Ets, {fitness, 0}),
  -    new_block(Ets),
       Res = genetica_utils:repeatedly(?NOF_BLOCKS, fun () -> block_run(Ets) end),
   %    io:format("~p~n", [Res]),
       ets:delete(Ets),
  
positive.code:             G
      end.
  
  
  fit_value(X, List) ->
      F = fun({_, Y}) when Y =:= X -> 1;
             (_) -> 0
          end,
      lists:sum(lists:map(F, List)).
  
  %%% Fitness function stuff
  gen_fit(G) ->
      Res = simulate_run(G),
      Avoids = lists:filter(fun ({X, _}) -> X =:= avoid end, Res),
      ALen = length(Avoids),
      Captures = lists:filter(fun ({X, _}) -> X =:= capture end, Res),
      CLen = length(Captures),
      Avs = fit_value(true, Avoids)/ALen * 1/3 * ?NOF_BLOCKS,
      Capts = fit_value(true, Captures)/CLen * 2/3 * ?NOF_BLOCKS,
  %    io:format("~p -- ~p~n", [Avs, Capts]),
      math:sqrt(Avs) + Capts.
  
  
  new_block(Ets) ->
  
negative.code:             gen_tcp:send(Sock, io_lib:fwrite("~w~n", [Floats])),
              ets:delete_all_objects(genetica_cognitive_ets),
              %% ^ hack, flip over to gen_server for next task.
              Refit = genetica_utils:pmap(fun refit/1, Pop),
              ets:insert(genetica_cognitive_ets, Refit),
              ok
      end.
  
  