2
獨回溯方法數獨,回溯算法
int xx = (pos.getX()/3) * 3;
int yy = (pos.getY()/3) * 3;
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
if ((xx + x != pos.getX()) && (yy + y != pos.getY())) {
possible[work[xx + x][yy + y]] = false;
其中x和y =
private byte x;
private byte y;
有人能解釋爲什麼我們三分裂和乘以3?
(pos.getY()/3) * 3;
(pos.getX()/3) * 3;