types.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package solver
  2. import (
  3. "sync/atomic"
  4. "gitea.ligthert.net/golang/sudoku-funpark/controller"
  5. )
  6. // Solve a given Sudoku puzzle by iterating through all possible solutions.
  7. type Solver struct {
  8. Controller *controller.Controller
  9. // Slice of possible blocks for the 1st row.
  10. row1s []string
  11. // Slice of possible blocks for the 2nd row.
  12. row2s []string
  13. // Slice of possible blocks for the 3rd row.
  14. row3s []string
  15. // Slice of possible blocks for the 4th row.
  16. row4s []string
  17. // Slice of possible blocks for the 5th row.
  18. row5s []string
  19. // Slice of possible blocks for the 6th row.
  20. row6s []string
  21. // Slice of possible blocks for the 7th row.
  22. row7s []string
  23. // Slice of possible blocks for the 8th row.
  24. row8s []string
  25. // Slice of possible blocks for the 9th row.
  26. row9s []string
  27. // Maximum number of possible solutions with the current set of rows.
  28. Iter int64
  29. // Progress counter, needs atomic due to the number of updates.
  30. counter atomic.Int64
  31. // Slice of rates for accurate duration estimation.
  32. rates []int64
  33. }