Remove validity check from update()

This commit is contained in:
Camden Dixie O'Brien 2022-11-23 22:31:39 +00:00
parent f7d132397f
commit 3d7a40cc58

6
sud.c
View File

@ -116,12 +116,6 @@ enum update_res update(struct sudoku *sud, unsigned r, unsigned c, unsigned val)
unsigned tr, tc; unsigned tr, tc;
assert(val < NDIGITS); assert(val < NDIGITS);
/* Check that the cell is undetermined and the value is allowed. */
if (sud->cells[r][c].det)
return ALREADY_DET;
if (!sud->cells[r][c].pvals[val])
return NOT_ALLOWED;
/* Update possible values of cells in same column. */ /* Update possible values of cells in same column. */
for (tr = 0; tr < NDIGITS; ++tr) { for (tr = 0; tr < NDIGITS; ++tr) {
if (tr == r || sud->cells[tr][c].det) if (tr == r || sud->cells[tr][c].det)