Friendly Bots
Agent Algorithm
A friendly agent looks at all the other agents he can see and randomly selects one to be his friend. However, he can only make another agent his friend if the other agent does not already have the agent selected as his friend. The friendly agent then tries to move toward his friend by accelerating towards him. The agent remembers who his friend is and continues to accelerate towards him as long as the friend remains visible. If the agent ever loses sight of his friend he simply selects another one at random given the selection criteria stated above. If ever a friend cannot be found the agent accelerates in a random direction to search for one.
Pseudocode
if !haveFriend or friend not in visibleAgents availableFriends = {} for all visibleAgents if visibleAgent.friend != me availableFriends <-- visibleAgent friend = selectRandom(availableFriends) if haveFriend accelerate towards friend else accelerate in random direction
Observed Behavior
Since friendship cannot be mutual, there will never be agents accelerating towards each other. An agent's friend will always be trying to get to another agent (or moving about randomly searching for a friend). What happens is kind of a "love triangle" phenomenon where agent A is accelerating towards agent B is accelerating towards agent C is accelerating towards agent A. When there is enough space for one of these chains they will spin around in circles chasing one another. When the chains get bigger they tend to look like a snake chasing after his tail with his body getting in the way.
Note that if the Agent Sight setting is set too high they tend to choose friends that are to far away and the "friendship snakes" can get knotted to the point where they can no longer move.