chore: add some notes

This commit is contained in:
NIHART, Jeremi 2024-09-08 18:12:53 +02:00
parent fb1d6d3f57
commit 86989d447e
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,12 @@ public class BackTrackingSolver : SolverBase
{ {
public BackTrackingSolver(Action<int[,]> displayBoard) : base(displayBoard) { } public BackTrackingSolver(Action<int[,]> displayBoard) : base(displayBoard) { }
/**
* note for future me :
* - Maybe pre-process the board to get the empty cells and already know used values per row, col and box
* - Maybe keep a track of the current index to avoid searching for the next empty cell in the all 2d array
* - Maybe avoid using negation
*/
public override (bool, int[,]) Solve(int[,] board) public override (bool, int[,]) Solve(int[,] board)
{ {
int row = -1, col = -1; int row = -1, col = -1;

View File

@ -58,7 +58,9 @@ namespace EndMove.Sudoku.Solver.Core
SudokuUtils.TwoDTo1D(store[0], out int[] sudoku1D); SudokuUtils.TwoDTo1D(store[0], out int[] sudoku1D);
SudokuUtils.DisplayBoard(sudoku1D); SudokuUtils.DisplayBoard(sudoku1D);
// TODO improve 2D backtracking solver
// TODO 1D solver with backtracking // TODO 1D solver with backtracking
// TODO Add time measurement
ISolver solver = new BackTrackingSolver(SudokuUtils.DisplayBoard); ISolver solver = new BackTrackingSolver(SudokuUtils.DisplayBoard);
var (status, lol) = solver.Solve(store[0]); var (status, lol) = solver.Solve(store[0]);