Given an array of 81 elements (meant to represent a 9×9 grid) how can I go over each element, grabbing the three around it and then performing an operation on those, then continuing to the next three of each row, column, or submatrix. Look below or at a sudoku grid to see the layout.
define COL(n) ((n) % 9) define ROW(n) ((n) / 9) define SUB(n) ((n / 3) % 9)
For example, I have
int grid[81];
and
int array_x[9], array_y[9], array_s[9];
Since the total 9x9 grid can be split into 9 of the following categories, there are nine elements in each array, and I hope to take the elements of each column (the x axis) in groups of threes, perform
r = ((a = ~a) & (b = ~b)) | ((b | a) & ~c); // or r = ((~a & ~b)) | ((~b | ~a) & ~c);
on them, take the three resultant numbers, and perform it on them, and then store it into the array.
If this sounds impossible, sorry, I'd like a different way to do this. Definitely open to suggestions...
Another try: