示例#1
0
 public HanoiPuzzle(int height)
 {
     validate  = new Validation();
     error     = false;
     y         = 5;
     maxHeight = height;
     print     = new Print(maxHeight);
     for (int i = maxHeight; i > 0; i--)
     {
         Tower1.Push(i);
     }
 }
示例#2
0
        /// <summary>
        /// Constructer
        /// </summary>
        /// <param name="numberOfDiscs"></param>
        public HanoiSimulator(int height)
        {
            // Sets max height variable
            this.maxHeight = height;
            print          = new Print(maxHeight);

            // Add circles to the first tower.
            for (int i = maxHeight; i > 0; i--)
            {
                Tower1.Push(i);
            }

            // Print towers before algorithm starts
            y = print.PrintTowers(Tower1, Tower2, Tower3, y);

            // Run the algorithm.
            SolveHanoi(maxHeight, Tower1, Tower2, Tower3);
        }