anchor.diff:  -define(AREA_WIDTH, 30).
   -define(TRACKER_SIZE, 5).
   -define(BLOCK_MAX_SIZE, 6).
  +-define(NOF_BLOCKS, 40).
  +-define(ETS_INTEGERS, [{{'$1','$2'},[{is_integer,'$1'}],['$2']}]).
   
   rand_node(Name) ->
       #vertex{name = Name, sigma = rand_between(-10, 0),
  
positive.code:        true ->
              NewPos = RawPos
      end,
      ets:insert(Ets, {tpos, NewPos}).
  
  edge_from(X) when X == a orelse X == b ->
      lists:seq(1, ?TRACKER_SIZE) ++ [a, b];
  edge_from(X) when X == c orelse X == d ->
      [a, b, c, d].
  
  get_output(Ets, X) when is_atom(X) ->
  
negative.code: cognitive_step(Ets) ->
      [new_vstate(Ets, Name) || Name <- [a, b, c, d]].
  
  move_block(Ets) ->
      [Block = #block{y=Y}] = ets:lookup(Ets, block),
      ets:insert(Ets, Block#block{y=Y-1}).
  
  step(Ets) ->
      sense(Ets),
      VertexStates = cognitive_step(Ets),
      actuate(Ets),
      move_block(Ets),
      ets:insert(Ets, VertexStates),
  %    io:format("~P~n~n", [ets:match_object(Ets, '_'), 100]),
      nil.
  
  block_run(Ets) ->
      new_block(Ets),
      genetica_utils:repeatedly(?AREA_HEIGHT, fun() -> step(Ets) end),
      sense(Ets),
      Sensed = ets:select(Ets, ?ETS_INTEGERS),
      case ets:lookup(Ets, block) of
          [#block{size=S, y=0, x=_}] ->
              if S >= ?TRACKER_SIZE ->
                      {avoid, not lists:any(fun(X) -> X =:= 1 end, Sensed)};
                 S < ?TRACKER_SIZE ->
                      {capture, lists:all(fun(X) -> X =:= 1 end, Sensed)}
              end
      end.
  
  simulate_run(G) ->
  %    io:format("whole:~n~p~n~n", [G]),
      Ets = ets:new(x, [set]),
      Firsts = lists:zip([#edge{from=F, to=T} || T <- [a, b],
                                                 F <- [1, 2, 3, 4, 5, a, b]],
                         lists:sublist(G, 2*7)),
      ets:insert(Ets, Firsts),
  %    io:format("first 14:~n~p~n~n", [Firsts]),
      OtherEdges = lists:zip([#edge{from=F, to=T} || T <- [c, d],
                                                     F <- [a, b, c, d]],
                             lists:sublist(G, 2*7 + 1, 2*4)),
  %    io:format("next 8:~n~p~n~n", [OtherEdges]),
      ets:insert(Ets, OtherEdges),
      Vertices = lists:sublist(G, 2*7 + 2*4 + 1, 4),
  %    io:format("and finally, vertices:~n~p~n~n", [Vertices]),
      ets:insert(Ets, [{Name, Vertex, #vstate{}} ||
                          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).
  
  
  
  