chore: add some notes
This commit is contained in:
parent
fb1d6d3f57
commit
0a70653bb2
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{67AA5CD2-BE13-4741-8F70-4FE3638271E4}"
|
||||
EndProject
|
||||
|
@ -1,9 +1,15 @@
|
||||
namespace EndMove.Sudoku.Solver.Core.Algorithms;
|
||||
namespace EndMove.Sudoku.Solver.Core.Algorithms;
|
||||
|
||||
public class BackTrackingSolver : SolverBase
|
||||
{
|
||||
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)
|
||||
{
|
||||
int row = -1, col = -1;
|
||||
|
@ -58,7 +58,9 @@ namespace EndMove.Sudoku.Solver.Core
|
||||
|
||||
SudokuUtils.TwoDTo1D(store[0], out int[] sudoku1D);
|
||||
SudokuUtils.DisplayBoard(sudoku1D);
|
||||
// TODO improve 2D backtracking solver
|
||||
// TODO 1D solver with backtracking
|
||||
// TODO Add time measurement
|
||||
|
||||
ISolver solver = new BackTrackingSolver(SudokuUtils.DisplayBoard);
|
||||
var (status, lol) = solver.Solve(store[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user