public void PlayMove() { while (finalPlan.Count > 0) { PrimitiveTask nextAction = finalPlan.Pop(); if (nextAction.PrimitiveConditionsMet(game.GetCurrentState())) { nextAction.executeTask(this); } else { plan(game.GetCurrentState()); break; } } plan(game.GetCurrentState()); }