public IEnumerable<BucketActionStep> Solve(ISolutionStrategy strategy) { if (!this.IsSolvable) throw new NotSolvableException("Attempting to solve an unsolvable Problem will result in infinite recursion"); ProblemState initialState = strategy.CurrentProblemState; yield return new BucketActionStep(strategy.StrategyName, FirstBucket, BucketActions.Init, 0, 0, "Initial State", initialState); while (!strategy.TestGoal()) { yield return strategy.TakeAction(); if (initialState.SameBucketState(strategy.CurrentProblemState)) throw new NotSolvableException("Problem has reached Initial State again and therefore is not Solvable"); } }