Add proper test to Backtracking/Sudoku

This replaces the "main" test in the implementation file.
This commit is contained in:
Roland Hummel
2021-10-02 22:51:25 +02:00
parent 15835ede13
commit eb99bdc06b
2 changed files with 53 additions and 23 deletions

View File

@ -72,26 +72,4 @@ class Sudoku {
}
}
function main () {
// main function with an example
const sudokuBoard = new Sudoku([
[3, 0, 6, 5, 0, 8, 4, 0, 0],
[5, 2, 0, 0, 0, 0, 0, 0, 0],
[0, 8, 7, 0, 0, 0, 0, 3, 1],
[0, 0, 3, 0, 1, 0, 0, 8, 0],
[9, 0, 0, 8, 6, 3, 0, 0, 5],
[0, 5, 0, 0, 9, 0, 6, 0, 0],
[1, 3, 0, 0, 0, 0, 2, 5, 0],
[0, 0, 0, 0, 0, 0, 0, 7, 4],
[0, 0, 5, 2, 0, 6, 3, 0, 0]
])
sudokuBoard.printBoard()
console.log('\n')
sudokuBoard.solve()
sudokuBoard.printBoard()
}
main()
export { Sudoku }