Beispiel #1
0
        static void Main(string[] args)
        {
            SudokuFieldProvider sudokuFieldProvider = SudokuFieldProvider.Instance;

            sudokuFieldProvider.SetInitialList(InitializeSquares(ReadFile()));
            SudokuSolver c = new SudokuSolver(sudokuFieldProvider);

            List <Thread> allThreads = new List <Thread>();

            for (int x = 0; x < Environment.ProcessorCount; x++)
            {
                Thread thread = new Thread(new ThreadStart(c.GetSolutions));
                thread.Start();
                allThreads.Add(thread);
            }

            foreach (Thread thread in allThreads)
            {
                thread.Join();
            }

            WriteResult(sudokuFieldProvider.GetResultList());

            Console.ReadLine();
        }
Beispiel #2
0
 public SudokuSolver(SudokuFieldProvider sudokuFieldProvider)
 {
     _sudokuFieldProvider = sudokuFieldProvider;
 }