types.go 1.2 KB

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