コード例 #1
0
        public void Solve(Puzzle puzzle)
        {
            _cancellationTokenSource = new CancellationTokenSource();

            Task.Factory.StartNew(
                SolvePuzzleInBackground,
                puzzle,
                _cancellationTokenSource.Token,
                TaskCreationOptions.LongRunning,
                TaskScheduler.Default);
        }
コード例 #2
0
ファイル: PuzzleSolver.cs プロジェクト: taylorjg/SudokuDlx
 public PuzzleSolver(Puzzle puzzle, CancellationToken cancellationToken)
 {
     _puzzle = puzzle;
     _cancellationToken = cancellationToken;
 }
コード例 #3
0
 public void Solve(Puzzle puzzle)
 {
     _onSearchStepCalls.ForEach(x => _onSearchStep(x.Item1, x.Item2));
 }
コード例 #4
0
ファイル: PuzzleSolver.cs プロジェクト: taylorjg/SudokuDlx
        private static IImmutableList<InternalRow> BuildInternalRows(Puzzle puzzle)
        {
            var rowsByCols =
                from row in Rows
                from col in Cols
                let coords = new Coords(row, col)
                let initialValue = puzzle.InitialValues.FirstOrDefault(iv => iv.Coords.Equals(coords))
                select BuildInternalRowsForCell(coords, initialValue);

            return rowsByCols.SelectMany(cols => cols).ToImmutableList();
        }