implement sudoku_solve_step
This commit is contained in:
18
src/sudoku.c
18
src/sudoku.c
@@ -26,10 +26,20 @@ void sudoku_place(u16 *board, u16 val, uint idx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sudoku_solve_step(u16 *board) {
|
void sudoku_solve_step(u16 *board) {
|
||||||
u16 bmask[SUDOKU_DEPTH_2]; // board mask
|
for (uint i = 0; i < SUDOKU_DEPTH_2; i++) {
|
||||||
memcpy(bmask, board, SUDOKU_DEPTH_2 * 2);
|
switch (board[i]) {
|
||||||
// TODO: first, we must somehow loop through the columns
|
case SUDOKU_1:
|
||||||
// TODO: then, we must write to the bmask or do *magic* for the bits designating to 1-9 to be unset if ONLY one of them is set
|
case SUDOKU_2:
|
||||||
|
case SUDOKU_3:
|
||||||
|
case SUDOKU_4:
|
||||||
|
case SUDOKU_5:
|
||||||
|
case SUDOKU_6:
|
||||||
|
case SUDOKU_7:
|
||||||
|
case SUDOKU_8:
|
||||||
|
case SUDOKU_9:
|
||||||
|
sudoku_place(board, board[i], i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sudoku_print(const u16 *board) {
|
void sudoku_print(const u16 *board) {
|
||||||
|
|||||||
Reference in New Issue
Block a user