diff --git a/main.go b/main.go index a5ae3e3..c8ba912 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,16 @@ package main -import "gitea.ligthert.net/golang/sudoku-funpark/solver" +import ( + "log" + + "gitea.ligthert.net/golang/sudoku-funpark/solver" +) func main() { + + // Set global logger parameters + log.SetFlags(log.LstdFlags | log.Lmicroseconds | log.Lshortfile) + + // Run the meat of the program solver.Run() } diff --git a/solver/processing.go b/solver/processing.go index db393ba..c27e815 100644 --- a/solver/processing.go +++ b/solver/processing.go @@ -1,7 +1,7 @@ package solver import ( - "fmt" + "log" "runtime" "strconv" ) @@ -27,7 +27,6 @@ func (solver *Solver) find_blocks(row *string, rows *[]int) { var curr_blocks []int func_row := *row - // fmt.Println(row) for letter := range func_row { if len(selection) == 0 { @@ -91,7 +90,7 @@ func (solver *Solver) routine_validator(rows1_index int, rows2_index int, rows3_ if solver.counter%1000000 == 0 { percentage = (float32(solver.counter) / (float32(solver.iter) / 100)) - fmt.Println("Processing:", percentage, "%; Procs:", runtime.NumGoroutine()) + log.Println("Processing:", percentage, "%; Procs:", runtime.NumGoroutine()) } } diff --git a/solver/solver.go b/solver/solver.go index d261175..d340516 100644 --- a/solver/solver.go +++ b/solver/solver.go @@ -1,7 +1,7 @@ package solver import ( - "fmt" + "log" ) func Run() { @@ -25,12 +25,12 @@ func Run() { solver.populate_blocks() // Print the total number of solutions to validate - fmt.Println("Number of solutions:", solver.iter) + log.Println("Number of solutions:", solver.iter) // Check the number of solutions solver.check_combinations() // Print the valid solutions - fmt.Println(solver.solutions) + log.Println(solver.solutions) }