static void Main(string[] args)
 {
     Hanoi h = new Hanoi();
     Stopwatch st = new Stopwatch();
     st.Start();
     ulong steps = h.CountSteps(64);
     st.Stop();
     Console.WriteLine(st.Elapsed.ToString());
     Console.WriteLine(steps);
 }
示例#2
0
        static void Main(string[] args)
        {
            Hanoi     h  = new Hanoi();
            Stopwatch st = new Stopwatch();

            st.Start();
            ulong steps = h.CountSteps(64);

            st.Stop();
            Console.WriteLine(st.Elapsed.ToString());
            Console.WriteLine(steps);
        }
示例#3
0
 static void Main(string[] args)
 {
     Warmup();
     for (int i = 1; i < 25; i++)
     {
         var   sw    = Stopwatch.StartNew();
         Hanoi tower = new Hanoi(i);
         tower.Solve();
         sw.Stop();
         if (!tower.IsSolved())
         {
             throw new Exception("Error - tower has not been solved properly !");
         }
         Console.WriteLine($"Solving problem of size {i} took {sw.Elapsed}");
     }
 }
示例#4
0
        private static void Warmup()
        {
            Hanoi tower = new Hanoi(20);

            tower.Solve();
        }