Exploiting natural selection to study adaptive behavior