| 181 | } |
| 182 | |
| 183 | void calculate_potentials(board_element *b) |
| 184 | { |
| 185 | for (unsigned i = 0; i < BOARD_SIZE; ++i) |
| 186 | { |
| 187 | b[i].potential_set = 0; |
| 188 | if (!b[i].solved_element) |
| 189 | { // element is not yet fixed |
| 190 | unsigned row = i / BOARD_DIM, col = i % BOARD_DIM; |
| 191 | for (unsigned potential = 1; potential <= BOARD_DIM; ++potential) |
| 192 | { |
| 193 | if (!in_row(b, row, col, potential) && !in_col(b, row, col, potential) |
| 194 | && !in_block(b, row, col, potential)) |
| 195 | b[i].potential_set |= 1 << (potential - 1); |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | bool valid_board(board_element *b) |
| 202 | { |
no test coverage detected