Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehjohn committed Apr 5, 2024
1 parent 0fb5c63 commit 329fc5e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/Sudoku.Console/BulkSolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void Solve(bool quiet = false, bool noSummary = false)
var clues = _puzzles[i].Clues;
if (! _timings.TryGetValue(clues, out (int Count, double Elapsed) value))
if (! _timings.TryGetValue(clues, out var value))
{
value = (0, 0);
Expand Down Expand Up @@ -126,7 +126,7 @@ public void Solve(bool quiet = false, bool noSummary = false)
var clues = _puzzles[i].Clues;
if (! _timings.TryGetValue(clues, out (int Count, double Elapsed) value))
if (! _timings.TryGetValue(clues, out var value))
{
value = (0, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/Sudoku.Console/TreeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private static Node GenerateNodes(int[] puzzle, SudokuResult result)

var root = node;

Node solved = node;
var solved = node;

var backtracking = false;

Expand Down
7 changes: 1 addition & 6 deletions src/Sudoku/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,7 @@ private bool CreateSolvedPuzzle(Span<int> puzzle, int cell = 0)

if (puzzle.IsValidSudoku())
{
if (cell == 80)
{
return true;
}

return CreateSolvedPuzzle(puzzle, cell + 1);
return cell == 80 || CreateSolvedPuzzle(puzzle, cell + 1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Sudoku/Solver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public SudokuResult Solve(int[] puzzle)
return new SudokuResult(_workingCopy, false, _steps, stopwatch.Elapsed.TotalMicroseconds, null, null, $"Insufficient number of clues: {81 - _score}");
}

_history = _historyType != HistoryType.None ? new List<Move>() : null;
_history = _historyType != HistoryType.None ? [] : null;

var candidates = GetSectionCandidates(span);

Expand Down

0 comments on commit 329fc5e

Please sign in to comment.