Compare commits
5 commits
6de3e286ed
...
e34b9ab57c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e34b9ab57c | ||
![]() |
da983e438b | ||
![]() |
d94bc05a4d | ||
![]() |
808ba05448 | ||
![]() |
4879795aa5 |
6 changed files with 56 additions and 34 deletions
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* This Java source file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
package sudoku;
|
||||
|
||||
public class App {
|
||||
public String getGreeting() {
|
||||
return "Hello World!";
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new App().getGreeting());
|
||||
}
|
||||
}
|
32
app/src/main/java/sudoku/Solver.java
Normal file
32
app/src/main/java/sudoku/Solver.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package sudoku;
|
||||
|
||||
public class Solver implements SudokuSolver {
|
||||
private int[][] board;
|
||||
|
||||
public Solver() {
|
||||
board = new int[9][9];
|
||||
}
|
||||
|
||||
public void setBoard(int[][] board) {
|
||||
this.board = board;
|
||||
}
|
||||
|
||||
public int[][] getBoard() {
|
||||
return board;
|
||||
}
|
||||
|
||||
public boolean solve() {
|
||||
}
|
||||
|
||||
public Boolean isSolved() {
|
||||
}
|
||||
|
||||
private boolean solve(int row, int col) {
|
||||
}
|
||||
|
||||
public boolean legal(int row, int col, int nbr) {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
}
|
||||
}
|
7
app/src/main/java/sudoku/SolverMain.java
Normal file
7
app/src/main/java/sudoku/SolverMain.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
package sudoku;
|
||||
|
||||
public class SolverMain {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -1,14 +1,11 @@
|
|||
package sudoku;
|
||||
|
||||
public interface SudokuSolver{
|
||||
|
||||
// Work in progress
|
||||
|
||||
public interface SudokuSolver {
|
||||
/**
|
||||
* Set sudoku board, numbers 1-9 are fixed values, 0 is unsolved.
|
||||
* Set sudoku board, numbers 1-9 are fixed values, 0 is unsolved.
|
||||
*/
|
||||
void setBoard(int[][] board);
|
||||
|
||||
|
||||
/**
|
||||
* Get the sudoku board
|
||||
*/
|
||||
|
@ -16,12 +13,14 @@ public interface SudokuSolver{
|
|||
|
||||
/**
|
||||
* Solve soduko
|
||||
*
|
||||
* @return true if solution could be found
|
||||
*/
|
||||
boolean solve();
|
||||
|
||||
/**
|
||||
* Check if digit is legal on the current board
|
||||
*
|
||||
* @param row
|
||||
* @param col
|
||||
* @param nbr
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* This Java source file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
package sudoku;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class AppTest {
|
||||
@Test void appHasAGreeting() {
|
||||
App classUnderTest = new App();
|
||||
assertNotNull(classUnderTest.getGreeting(), "app should have a greeting");
|
||||
}
|
||||
}
|
12
app/src/test/java/sudoku/SolverTest.java
Normal file
12
app/src/test/java/sudoku/SolverTest.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package sudoku;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class SolverTest {
|
||||
@Test void boardTest() {
|
||||
Solver solver = new Solver();
|
||||
solver.solve();
|
||||
assertTrue(solver.isSolved());
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue