Modeling a butterfly’s adaptation to the environment