This commit is contained in:
ZennDev1337 2024-04-02 09:36:59 +02:00
parent c4c3abd6d2
commit 45b114d7ef
3 changed files with 15 additions and 8 deletions

View file

@ -1,4 +0,0 @@
package Solver
type SudokuSolver struct {
}

10
SudokuValidator/Solver.go Normal file
View file

@ -0,0 +1,10 @@
package SudokuValidator
type SudokuSolver struct {
Validator *SudokuValidator
}
func NewSudokuSolver() *SudokuSolver {
solver := &SudokuSolver{Validator: NewSudokuValidator()}
return solver
}

View file

@ -31,11 +31,12 @@ func main() {
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
}
tick := time.Tick(time.Millisecond)
validator := SudokuValidator.NewSudokuValidator()
start := <-tick
fmt.Println("Example 1 is valid:", validator.IsValidSudoku(&board1))
fmt.Println("Example 2 is valid:", validator.IsValidSudoku(&board2))
solver := SudokuValidator.NewSudokuSolver()
fmt.Println("Example 1 is valid:", solver.Validator.IsValidSudoku(&board1))
fmt.Println("Example 2 is valid:", solver.Validator.IsValidSudoku(&board2))
end := <-tick
elapsed := end.Sub(start)
fmt.Println("Time elapsed:", elapsed.Microseconds(), "microseconds")