I'm doing an algorithm in Java using BlueJ as an IDE. I use trackback algorithm to solve the problem and everything works perfectly except for the checkstyle. The checkstyle errors are:
Assignment of parameter i is not allowed [on line 336]
Assignment of parameter j is not allowed [on line 337]
However, as trackback requires the variables to be passed as the arguments and also be edited according to the situation, so I can't do anything about this.
Does anybody know how to fix this? This is my code (error lines are commented):
public boolean solve(int i, int j) {
if (i == 9) {
i = 0; // line 336
if (++j == 9) { // line 337
return true;
}
}
...
for (int value = 1; value <= 9; ++value) {
if (possible[value]) {
setCell(i,j,value);
if (solve(i+1,j)) {
return true;
}
}
}
game[i][j] = 0;
return false;
}