On-the-fly Strategy Adaptation for ad-hoc Agent Coordination