Compare commits
No commits in common. "master" and "dogge" have entirely different histories.
2 changed files with 6 additions and 23 deletions
|
@ -20,18 +20,10 @@ public class Solver implements SudokuSolver {
|
|||
this.board = board;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>
|
||||
* Note that this returns a copy of the board, not the actual board
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int[][] getBoard() {
|
||||
int[][] copy = new int[9][9];
|
||||
for (int row = 0; row < 9; row++) {
|
||||
System.arraycopy(board[row], 0, copy[row], 0, 9);
|
||||
}
|
||||
return copy;
|
||||
return board;
|
||||
}
|
||||
|
||||
/** Resets the board to all zeros */
|
||||
|
@ -42,6 +34,7 @@ public class Solver implements SudokuSolver {
|
|||
row[i] = 0;
|
||||
}
|
||||
}
|
||||
// board = new int[9][9];
|
||||
}
|
||||
|
||||
/* {@inheritDoc} */
|
||||
|
@ -127,8 +120,8 @@ public class Solver implements SudokuSolver {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>
|
||||
* This is <b>not</b> checked for validity
|
||||
*/
|
||||
|
|
|
@ -17,12 +17,8 @@ class SolverTest {
|
|||
Solver solver = new Solver();
|
||||
int[][] board = new int[9][9];
|
||||
solver.setBoard(board);
|
||||
|
||||
for (int row = 0; row < 9; row++) {
|
||||
assertArrayEquals(board[row], solver.getBoard()[row]);
|
||||
}
|
||||
assertEquals(board, solver.getBoard());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void randomizeBoardTest() {
|
||||
|
@ -32,12 +28,6 @@ class SolverTest {
|
|||
assertNotEquals(board, solver.getBoard());
|
||||
}
|
||||
|
||||
@Test
|
||||
void emptyTest() {
|
||||
Solver solver = new Solver();
|
||||
assertTrue(solver.solve());
|
||||
}
|
||||
|
||||
@Test
|
||||
void legalTest() {
|
||||
Solver solver = new Solver();
|
||||
|
|
Loading…
Reference in a new issue