unused.txt 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // Processing
  2. func (solver *Solver) routine_row1(index1 int) {
  3. for index2 := range solver.row2s {
  4. go solver.routine_row2(index1, index2)
  5. }
  6. }
  7. func (solver *Solver) routine_row2(index1 int, index2 int) {
  8. for index3 := range solver.row3s {
  9. go solver.routine_row3(index1, index2, index3)
  10. }
  11. }
  12. func (solver *Solver) routine_row3(index1 int, index2 int, index3 int) {
  13. for index4 := range solver.row4s {
  14. go solver.routine_row4(index1, index2, index3, index4)
  15. }
  16. }
  17. func (solver *Solver) routine_row4(index1 int, index2 int, index3 int, index4 int) {
  18. for index5 := range solver.row5s {
  19. go solver.routine_row5(index1, index2, index3, index4, index5)
  20. }
  21. }
  22. func (solver *Solver) routine_row5(index1 int, index2 int, index3 int, index4 int, index5 int) {
  23. for index6 := range solver.row6s {
  24. go solver.routine_row6(index1, index2, index3, index4, index5, index6)
  25. }
  26. }
  27. func (solver *Solver) routine_row6(index1 int, index2 int, index3 int, index4 int, index5 int, index6 int) {
  28. for index7 := range solver.row7s {
  29. go solver.routine_row7(index1, index2, index3, index4, index5, index6, index7)
  30. }
  31. }
  32. func (solver *Solver) routine_row7(index1 int, index2 int, index3 int, index4 int, index5 int, index6 int, index7 int) {
  33. for index8 := range solver.row8s {
  34. go solver.routine_row8(index1, index2, index3, index4, index5, index6, index7, index8)
  35. }
  36. }
  37. func (solver *Solver) routine_row8(index1 int, index2 int, index3 int, index4 int, index5 int, index6 int, index7 int, index8 int) {
  38. for index9 := range solver.row9s {
  39. go solver.routine_row9(index1, index2, index3, index4, index5, index6, index7, index8, index9)
  40. }
  41. }
  42. func (solver *Solver) routine_row9(index1 int, index2 int, index3 int, index4 int, index5 int, index6 int, index7 int, index8 int, index9 int) {
  43. go solver.routineValidator(index1, index2, index3, index4, index5, index6, index7, index8, index9)
  44. }
  45. // blocks.go
  46. func (solver *Solver) generate_blocks() []int {
  47. var blocks []int
  48. decvals := [9]int{49, 50, 51, 52, 53, 54, 55, 56, 57}
  49. for counter := 123456789; counter <= 987654321; counter++ {
  50. // Convert number to string ([]byte)
  51. digits := strconv.Itoa(counter)
  52. // Check if every number is only represented only once
  53. var valid bool
  54. valid = true
  55. for decval := range decvals {
  56. var count int
  57. for digit := range digits {
  58. if digits[digit] == byte(decvals[decval]) {
  59. count = count + 1
  60. }
  61. }
  62. if count != 1 {
  63. valid = false
  64. }
  65. }
  66. if valid {
  67. blocks = append(blocks, counter)
  68. }
  69. }
  70. return blocks
  71. }
  72. // stash.go
  73. func (solver *Solver) print_block(block int) {
  74. digits := strconv.Itoa(block)
  75. fmt.Printf("%c %c %c\n%c %c %c\n%c %c %c\n\n", digits[0], digits[1], digits[2], digits[3], digits[4], digits[5], digits[6], digits[7], digits[8])
  76. }