38 lines
764 B
Go

package solver
import (
"log"
"runtime"
"strconv"
)
func Run() {
// Instantiate the Solver interface
solver := Solver{}
// Parse and handle flags
solver.parse_flags()
// Report number of CPUs being used, if set.
if runtime.NumCPU() != solver.numcpus {
log.Println("Using " + strconv.Itoa(solver.numcpus) + " CPUs, (was " + strconv.Itoa(runtime.NumCPU()) + ")")
}
// Load blocks from CSV file
solver.load_blocks()
// Find rows that fit with the entered rows
solver.populate_blocks()
// Print the total number of solutions to validate
log.Println("Number of (potential) solutions:", solver.iter)
// Check the number of solutions
go solver.check_combinations()
solver.tracker()
// Print the valid solutions
solver.print_solutions()
}