Enable nicer logging.
This commit is contained in:
parent
5a9f22edb7
commit
8ec56bc3d8
11
main.go
11
main.go
@ -1,7 +1,16 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "gitea.ligthert.net/golang/sudoku-funpark/solver"
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"gitea.ligthert.net/golang/sudoku-funpark/solver"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
|
// Set global logger parameters
|
||||||
|
log.SetFlags(log.LstdFlags | log.Lmicroseconds | log.Lshortfile)
|
||||||
|
|
||||||
|
// Run the meat of the program
|
||||||
solver.Run()
|
solver.Run()
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package solver
|
package solver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"log"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
@ -27,7 +27,6 @@ func (solver *Solver) find_blocks(row *string, rows *[]int) {
|
|||||||
var curr_blocks []int
|
var curr_blocks []int
|
||||||
func_row := *row
|
func_row := *row
|
||||||
|
|
||||||
// fmt.Println(row)
|
|
||||||
for letter := range func_row {
|
for letter := range func_row {
|
||||||
|
|
||||||
if len(selection) == 0 {
|
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 {
|
if solver.counter%1000000 == 0 {
|
||||||
percentage = (float32(solver.counter) / (float32(solver.iter) / 100))
|
percentage = (float32(solver.counter) / (float32(solver.iter) / 100))
|
||||||
fmt.Println("Processing:", percentage, "%; Procs:", runtime.NumGoroutine())
|
log.Println("Processing:", percentage, "%; Procs:", runtime.NumGoroutine())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package solver
|
package solver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run() {
|
func Run() {
|
||||||
@ -25,12 +25,12 @@ func Run() {
|
|||||||
solver.populate_blocks()
|
solver.populate_blocks()
|
||||||
|
|
||||||
// Print the total number of solutions to validate
|
// 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
|
// Check the number of solutions
|
||||||
solver.check_combinations()
|
solver.check_combinations()
|
||||||
|
|
||||||
// Print the valid solutions
|
// Print the valid solutions
|
||||||
fmt.Println(solver.solutions)
|
log.Println(solver.solutions)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user