first commit
This commit is contained in:
commit
59ed4ac5f9
6 changed files with 143 additions and 0 deletions
41
main.go
Normal file
41
main.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"SudokuSolver/SudokuValidator"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
board1 := [][]byte{
|
||||
{'5', '3', '.', '.', '7', '.', '.', '.', '.'},
|
||||
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
|
||||
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
|
||||
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
|
||||
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
|
||||
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
|
||||
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
|
||||
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
|
||||
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
|
||||
}
|
||||
|
||||
board2 := [][]byte{
|
||||
{'8', '3', '.', '.', '7', '.', '.', '.', '.'},
|
||||
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
|
||||
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
|
||||
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
|
||||
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
|
||||
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
|
||||
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
|
||||
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
|
||||
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
|
||||
}
|
||||
tick := time.Tick(time.Millisecond)
|
||||
start := <-tick
|
||||
validator := SudokuValidator.NewSudokuValidator()
|
||||
fmt.Println("Example 1 is valid:", validator.IsValidSudoku(&board1))
|
||||
fmt.Println("Example 2 is valid:", validator.IsValidSudoku(&board2))
|
||||
end := <-tick
|
||||
elapsed := end.Sub(start)
|
||||
fmt.Println("Time elapsed:", elapsed.Microseconds(), "microseconds")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue