Beispiel #1
0
        private void moveTopTo(StackTower t)
        {
            int top = disks.Pop();

            t.add(top);
            Console.Out.WriteLine("Move disk " + top + " from " + Index +
                                  " to " + t.Index);
        }
Beispiel #2
0
 public void moveDisks(int n, StackTower destination, StackTower buffer)
 {
     if (n > 0)
     {
         moveDisks(n - 1, buffer, destination);
         moveTopTo(destination);
         buffer.moveDisks(n - 1, destination, this);
     }
 }