
Based on the above coordinates in the image above, I would like to be able to calculate which βsquareβ is highlighted in red, the selected cell belongs.
I solve the sudoku puzzle, and I have access to the width of each square, as well as the row / column that the cell is in.
I had problems calculating the "number" of the square to which the cell belongs (they start from 1 and increase from left to right, from top to bottom), so the number of squares is higher:
1 | 2
3 | 4
How could I calculate this? We appreciate any suggestions. Either a Java-specific method, or just an algorithm will be fine :)
source
share