Пример #1
0
        void FindSolution()
        {
            var refCube = PrepareCubeAndPrint();
            var finder  = new RecursiveSolutionFinder3(refCube, (x, y) => PrintSolution(x, y), eqFunc, depth, threads);

            StartPerformanceCounterThread(finder);

            var result = finder.Run();

            Console.WriteLine("================= FINISHED ============================");
            Console.WriteLine("Checked " + finder.Combinations + " combinations");
        }
Пример #2
0
 void StartPerformanceCounterThread(RecursiveSolutionFinder3 finder)
 {
     new Thread(() =>
     {
         long combinations = 0;
         for (int i = 0; i < 3; i++)
         {
             int seconds = 10;
             Thread.Sleep(TimeSpan.FromSeconds(seconds));
             var newcombinations = finder.Combinations;
             lock (printLock)
             {
                 Console.WriteLine((newcombinations - combinations) / seconds + " per sec");
             }
             combinations = newcombinations;
         }
     }).Start();
 }