Thanks Wade,
That is much appreciated! I didn't know about this group - otherwise I would have uploadet my model here. And thanks for taking the time to augment the code with debug info. I didn't think of this.
On a side note: I'm considering alternative modeling approaches to this problem. Specifically I'm having doubts about this snake-like following behavior. Somehow the idea of a string of cells "following a head" feels wrong. Accidental complexity as opposed to essential complexity to quote Brooks ;-)
A better approach might be too link the cells, and have the individual cells move randomly - but still constricted by the links. In effect having two motions combined:
- the movement of individual cells - similar to the elements of a swinging rope.
- the movement of the overall string - just floating around
In some ways similar to larvae of Chironomids in an aquarium (pardon the geeky reference ;-) ) : they float around with the water, but also twist and turn in jerking movements.
But I haven't been able to figure out how to do this. I.e. combining two sets of movement. It seems like it requires a notion of composite agents, as the string (the "whole" agent) moves according to factors in the environment (flow of fluid etc.), whereas the elements of the string (the "part" agents) move according to individual rules, but still restricted by constraints enforced by the composite structure of the "whole" agent. Hmm...
Anyway - I'd really like to know why the current design breaks.
Best regards,
Palle