Flexible strategy and social evolution