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); }
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}"); } }
private static void Warmup() { Hanoi tower = new Hanoi(20); tower.Solve(); }