private static IState GetState(IState parentState, XElement stateElement, Solver solver) => stateElement == null ? parentState : StateParser.Parse(null, parentState, stateElement, solver).State;
private static Solver SolverWithPuzzleStates(this Solver initialSolver, XDocument document) => (from statesElement in document.Root.Elements("States")
private static (Algorithm Algorithm, PuzzleColor[] Colors) GetBaseAlgorithm(XElement element, Solver solver) { var attribute = element.Attribute("Base"); if (attribute == null) { return(Algorithm.Empty, null); } var(name, colors) = ExpressionParser.ParseInner(attribute.Value); Algorithm algorithm; if (!solver.AlgorithmTemplates.TryGetValue(name, out algorithm)) { if (!solver.Algorithms.TryGetValue(name, out algorithm)) { throw new InvalidOperationException($"The '{name}' algorithm or algorithm template could not be found."); } } return(algorithm, colors); }