All pastes #33189 Raw Edit

Stuff

public text v1 · immutable
#33189 ·published 2005-12-10 16:04 UTC
rendered paste body
void Compute_Block (
		alters Sudoku_Matrix& m,
		preserves Integer r,
		preserves Integer c
	)
{
	object Integer i, j, right, bottom, y;
	object Text x, x_from_map;
	
	if (r < 3) {
		i = 0;
	} else if (r < 6) {
		i = 3;
	} else {
		i = 6;
	} // end if

	if (c < 3) {
		j = 0;
	} else if (c < 6) {
		j = 3;
	} else {
		j = 6;
	} // end if

	right = i + 3;
	bottom = j + 3;
	
	for (i; i < right; i++) {
		 for (j; j < bottom; j++) {
			x = m[i][j]->value;
			if (m[r][c]->possible.Is_Defined (x)) {
				// Value Is_Defined in block, Undefine from m[r][c]->possible
				m[r][c]->possible.Undefine (x, x_from_map, y);
			} // end if
		} // end for
	} // end for
} // Compute_Block