public IEnumerable <LevelState> GetPossibleNextStates() { LevelState copy = Clone(); int[] dxs = { 1, -1, 0, 0 }; int[] dys = { 0, 0, 1, -1 }; for (int i = 0; i < 4; i++) { if (copy.Move(dxs[i], dys[i])) { yield return(copy); copy = Clone(); } } if (copy.Pass()) { yield return(copy); } // Copy if continuing }
public bool Pass() { return(Act(() => currentState.Pass())); }