Esempio n. 1
0
 void moveCCW(int n)
 {
     for (int i = 0; i < n; i++)
     {
         current = current.prev;
     }
 }
Esempio n. 2
0
 void moveCW(int n)
 {
     for (int i = 0; i < n; i++)
     {
         current = current.next;
     }
 }
Esempio n. 3
0
        public Day09(string rawInput)
        {
            var asciiVals = rawInput.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            nPlayers   = Int32.Parse(asciiVals[0]);
            lastMarble = Int32.Parse(asciiVals[6]);
            current    = new CircNode();
        }
Esempio n. 4
0
        void removeCurrent()
        {
            var cw  = current.next;
            var ccw = current.prev;

            ccw.next = cw;
            cw.prev  = ccw;
            current  = cw;
        }
Esempio n. 5
0
        void insertToRight(int m)
        {
            var node = new CircNode();
            var cw   = current.next;
            var ccw  = current;

            cw.prev   = node;
            ccw.next  = node;
            node.next = cw;
            node.prev = ccw;
            node.val  = m;
            current   = node;
        }
Esempio n. 6
0
 public CircNode()
 {
     prev = next = this;
     val  = 0;
 }