/// <summary> /// Creates a new instance of SetupCube with no last layer pieces colored (except the center) /// </summary> public SetupCube(double sizeRatio) : base() { URBList = new CircularLinkedList <CubeColor>(CubeColor.None, CubeColor.None, CubeColor.None); URFList = new CircularLinkedList <CubeColor>(CubeColor.None, CubeColor.None, CubeColor.None); ULFList = new CircularLinkedList <CubeColor>(CubeColor.None, CubeColor.None, CubeColor.None); ULBList = new CircularLinkedList <CubeColor>(CubeColor.None, CubeColor.None, CubeColor.None); URList = new CircularLinkedList <CubeColor>(CubeColor.None, CubeColor.None); ULList = new CircularLinkedList <CubeColor>(CubeColor.None, CubeColor.None); UFList = new CircularLinkedList <CubeColor>(CubeColor.None, CubeColor.None); UBList = new CircularLinkedList <CubeColor>(CubeColor.None, CubeColor.None); _edges = new List <CircularLinkedList <CubeColor> > { URList, UFList, ULList, UBList }; _corners = new List <CircularLinkedList <CubeColor> > { URFList, URBList, ULFList, ULBList }; _leftCorners = new List <CubeColor> { CubeColor.Red, CubeColor.Green, CubeColor.Orange, CubeColor.Blue }; _edgeColors = new List <CubeColor> { CubeColor.Red, CubeColor.Green, CubeColor.Orange, CubeColor.Blue }; _actions = new Stack <Action>(); State = SetupState.Orienatation; SizeRatio = sizeRatio; }
// Find the yellow node of a circular linked list representing a cubie public ListNode <CubeColor> GetYellowNode(CircularLinkedList <CubeColor> list) { ListNode <CubeColor> node = list.Head; do { if (node.Value == CubeColor.Yellow) { return(node); } node = node.Right; }while (node != list.Head); throw new InvalidOperationException("piece does not have yellow"); }