Compare commits

...

5 commits

Author SHA1 Message Date
Imbus
e34b9ab57c Solver implementation in Solver.java 2023-12-05 13:15:09 +01:00
Imbus
da983e438b Some example tests 2023-12-05 13:14:25 +01:00
Imbus
d94bc05a4d Redundant comment removal 2023-12-05 13:14:02 +01:00
Imbus
808ba05448 Main is in SolverMain.java 2023-12-05 13:13:44 +01:00
Imbus
4879795aa5 Formatting 2023-12-05 13:08:00 +01:00
6 changed files with 56 additions and 34 deletions

View file

@ -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());
}
}

View 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() {
}
}

View file

@ -0,0 +1,7 @@
package sudoku;
public class SolverMain {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

View file

@ -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

View file

@ -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");
}
}

View 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());
}
}