public override void Process(List <Node> nodes, INotationParser parser) { var index = nodes.IndexOf(this); // 1 * ( 2 + 3 ) ==> 1 2 3 + * // 1 * ( 2 + 3 ) ==> * 1 + 2 3 var leftNode = parser.GetLeftNode(nodes, index); var rightNode = parser.GetRightNode(nodes, index); Left = leftNode; Right = rightNode; if (parser.WrapOperators() && (rightNode is SymbolNode r) && r.Symbol.Priority > Symbol.Priority) { var parenth = new ParenthesisNode { InternalNode = rightNode, Type = ParenthesisType.Wrap }; Right = parenth; } if (parser.WrapOperators() && (leftNode is SymbolNode l) && l.Symbol.Priority > Symbol.Priority) { var parenth = new ParenthesisNode { InternalNode = leftNode, Type = ParenthesisType.Wrap }; Left = parenth; } nodes.Remove(leftNode); nodes.Remove(rightNode); }
internal RubiksCube(INotationParser parser, ICubieConfigurator configurator, int cubeSize) { _faces = new Dictionary <RubiksDirection, CubeFace>(); _faces.Add(RubiksDirection.Front, new CubeFace(RubiksDirection.Front, cubeSize)); _faces.Add(RubiksDirection.Back, new CubeFace(RubiksDirection.Back, cubeSize)); _faces.Add(RubiksDirection.Up, new CubeFace(RubiksDirection.Up, cubeSize)); _faces.Add(RubiksDirection.Down, new CubeFace(RubiksDirection.Down, cubeSize)); _faces.Add(RubiksDirection.Left, new CubeFace(RubiksDirection.Left, cubeSize)); _faces.Add(RubiksDirection.Right, new CubeFace(RubiksDirection.Right, cubeSize)); _cubeSize = cubeSize; _parser = parser; _cubies = configurator.CreateCubies(cubeSize); }
public RubiksCube(INotationParser parser, int cubeSize = 3) : this(parser, new SolvedPuzzleCubieConfigurator(), cubeSize) { }
public override void Process(List <Node> nodes, INotationParser parser) { // Number nodes just have a value and have no further processing. }
public NotationNinja(INotationParser parser) { _parser = parser; }
public override void Process(List <Node> nodes, INotationParser parser) { throw new NotImplementedException(); }
public abstract void Process(List <Node> nodes, INotationParser parser);