1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
int set_known_check(const Sudoku& puzzle, int row, int col)
{
if (!puzzle.is_known(row, col)) //only do stuff if the value isn't already known
{
for (int val = 1; val <= 9; ++val) //TODO: fix indentation
{
switch (val)
{
case 1:
if (puzzle.one_possible(row, col) && (!(puzzle.two_possible(row,col) || puzzle.three_possible(row,col)
|| puzzle.four_possible(row,col) || puzzle.five_possible(row,col) || puzzle.six_possible(row,col)
|| puzzle.seven_possible(row,col) || puzzle.eight_possible(row,col) || puzzle.nine_possible(row,col))))
{
return val;
}
break;
case 2:
if (puzzle.two_possible(row, col) && (!(puzzle.one_possible(row,col) || puzzle.three_possible(row,col)
|| puzzle.four_possible(row,col) || puzzle.five_possible(row,col) || puzzle.six_possible(row,col)
|| puzzle.seven_possible(row,col) || puzzle.eight_possible(row,col) || puzzle.nine_possible(row,col))))
{
return val;
}
break;
|