chore: add some notes
This commit is contained in:
parent
fb1d6d3f57
commit
86989d447e
@ -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;
|
||||||
|
@ -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]);
|
||||||
|
Loading…
Reference in New Issue
Block a user