Teleological Reasoning in Software Adaptation: A Case Study in Game-Playing Agents