Matlab solution to a crowd where people try to maintain equidistance between two others in the crowd.
crowd.m is a script which simulates a teaming game where a number of people placed in a room, they pick two others at random, and attempt move to a position in the room where they form an equilateral triangle between themselves and their two chosen team members.
Uses the handle class hPerson.m which simulates all the behaviours of a person in a unit size room.
Uses the helper class cPosition.m to manipulate the x,y positions of each person in the room.
Moral of this story is that you can't acheive perfection. Only way to succeed is for everyone in the room to accept some error.