Simulating the Evolution of Teamwork