public MoveTree( int gridSize ) { GridSize = gridSize; _root = new Treenode(); _root.AddLeftTurn(); _root.AddRightTurn(); }
public void Treenode_WhenAddingRightTurn_ChildIncrementsRightTurnCount() { var root = new Treenode { Name = "" }; var child = root.AddRightTurn(); Assert.AreEqual(root.RightTurns + 1, child.RightTurns); Assert.AreEqual(child.Name, "R"); }
public Treenode AddRightTurn() { var node = new Treenode() { Name = this.Name + "R", RightTurns = this.RightTurns + 1, LeftTurns = this.LeftTurns }; this.RightChild = node; return node; }