40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package solver
|
|
|
|
import (
|
|
"sync/atomic"
|
|
|
|
"gitea.ligthert.net/golang/sudoku-funpark/controller"
|
|
"gitea.ligthert.net/golang/sudoku-funpark/outputter"
|
|
)
|
|
|
|
// Solve a given Sudoku puzzle by iterating through all possible solutions.
|
|
type Solver struct {
|
|
Controller *controller.Controller
|
|
// Slice of possible blocks for the 1st row.
|
|
row1s []string
|
|
// Slice of possible blocks for the 2nd row.
|
|
row2s []string
|
|
// Slice of possible blocks for the 3rd row.
|
|
row3s []string
|
|
// Slice of possible blocks for the 4th row.
|
|
row4s []string
|
|
// Slice of possible blocks for the 5th row.
|
|
row5s []string
|
|
// Slice of possible blocks for the 6th row.
|
|
row6s []string
|
|
// Slice of possible blocks for the 7th row.
|
|
row7s []string
|
|
// Slice of possible blocks for the 8th row.
|
|
row8s []string
|
|
// Slice of possible blocks for the 9th row.
|
|
row9s []string
|
|
// Maximum number of possible solutions with the current set of rows.
|
|
Iter uint64
|
|
// Progress counter, needs atomic due to the number of updates.
|
|
counter atomic.Uint64
|
|
// Slice of rates for accurate duration estimation.
|
|
rates []uint64
|
|
// Reference to Outputter interface
|
|
Outp *outputter.Outputter
|
|
}
|