How Animals Adapt to their Environment