Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void solveWithout(int row, int col) {
- if(row > squares.length - 1) {
- solutions.insert(squares);
- return;
- }
- if(squares[row][col] instanceof PrefilledSquare)
- nextWithout(row, col);
- else {
- for (int value = 1; value <= squares.length; value++) {
- if(squares[row][col].legalValue(value)) {
- squares[row][col].setValue(value + "");
- nextWithout(row, col);
- }
- }
- squares[row][col].setValue(0 + "");
- }
- }
- public void nextWithout(int row, int col) {
- if(col < squares.length - 1)
- solveWithout(row, ++col);
- else
- solveWithout(++row, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement