Пример #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            var board           = Problems[4];
            var printingService = new BoardPrintService(new OrientationService());
            var solveService    = new SolveBoardService(printingService);

            Console.Write(printingService.ToString(board));

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            var result = solveService.Solve(board);

            stopWatch.Stop();
            // Get the elapsed time as a TimeSpan value.
            TimeSpan ts = stopWatch.Elapsed;

            // Format and display the TimeSpan value.
            Console.WriteLine($"Solution found: {result.ToString()}");
            Console.WriteLine(printingService.ToString(board, result));
            Console.WriteLine(string.Format("It tooked: {0:00}:{1:00}:{2:00}.{3:00}",
                                            ts.Hours, ts.Minutes, ts.Seconds,
                                            ts.Milliseconds));
            Console.ReadKey();
        }
Пример #2
0
 public SolveBoardService(BoardPrintService printingService)
 {
     _printingService = printingService;
 }