/** * * @param algorithm A space separated String of moves to apply to state * @return The resulting PuzzleState * @throws InvalidScrambleException */ public PuzzleState ApplyAlgorithm(string algorithm) { PuzzleState state = this; foreach (var move in SplitAlgorithm(algorithm)) { try { state = state.Apply(move); } catch (InvalidMoveException e) { throw new InvalidScrambleException(algorithm, e); } } return(state); }
private void MoveCommandAction(object parameter) { PuzzleState = PuzzleState.Apply(Enum.Parse <PuzzleMovement>((string)parameter)); }