Example #1
0
        public void Test1()
        {
            Tower t1 = new Tower(new Stack<int>(new[] {6, 5, 4, 3, 2, 1} ));
            Tower t2 = new Tower();
            Tower t3 = new Tower();

            t1.moveDiscs(4, t2, t3);
        }
Example #2
0
        public void moveDiscs(int count, Tower spare, Tower dest)
        {
            if (count == 0)
            {
                return;
            }

            moveDiscs(count - 1, dest, spare);
            moveDisc(dest);
            spare.moveDiscs(count - 1, this, dest);
        }
Example #3
0
 public void moveDisc(Tower dest)
 {
     dest.addDisc(stack.Pop());
 }