Using ad hoc teamwork to influence a flock.