MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / calculate_potentials

Function calculate_potentials

examples/sudoku.cpp:183–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183void 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
201bool valid_board(board_element *b)
202{

Callers 1

partial_solveFunction · 0.85

Calls 3

in_rowFunction · 0.85
in_colFunction · 0.85
in_blockFunction · 0.85

Tested by

no test coverage detected