When do animals learn the evolutionarily stable strategy?