Exemple #1
0
 void moveCCW(int n)
 {
     for (int i = 0; i < n; i++)
     {
         current = current.prev;
     }
 }
Exemple #2
0
 void moveCW(int n)
 {
     for (int i = 0; i < n; i++)
     {
         current = current.next;
     }
 }
Exemple #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();
        }
Exemple #4
0
        void removeCurrent()
        {
            var cw  = current.next;
            var ccw = current.prev;

            ccw.next = cw;
            cw.prev  = ccw;
            current  = cw;
        }
Exemple #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;
        }
Exemple #6
0
 public CircNode()
 {
     prev = next = this;
     val  = 0;
 }