Instructions for QQwing

QQWing is a command line program that accepts many options.

qqwing <options>
Sudoku solver and generator.
  --generate <num>     Generate new puzzles
  --solve              Solve all the puzzles from standard input
  --difficulty <diff>  Generate only simple,easy, intermediate, or expert
  --symmetry <sym>     Symmetry: none, rotate90, rotate180, mirror, flip, or random
  --puzzle             Print the puzzle (default when generating)
  --nopuzzle           Do not print the puzzle (default when solving)
  --solution           Print the solution (default when solving)
  --nosolution         Do not print the solution (default when generating)
  --stats              Print statistics about moves used to solve the puzzle
  --nostats            Do not print statistics (default)
  --timer              Print time to generate or solve each puzzle
  --notimer            Do not print solve or generation times (default)
  --count-solutions    Count the number of solutions to puzzles
  --nocount-solutions  Do not count the number of solutions (default)
  --history            Print trial and error used when solving
  --nohistory          Do not print trial and error to solve (default)
  --instructions       Print the steps (at least 81) needed to solve the puzzle
  --noinstructions     Do not print steps to solve (default)
  --log-history        Print trial and error to solve as it happens
  --nolog-history      Do not print trial and error  to solve as it happens
  --one-line           Print puzzles on one line of 81 characters
  --compact            Print puzzles on 9 lines of 9 characters
  --readable           Print puzzles in human readable form (default)
  --csv                Output CSV format with one line puzzles
  --help               Print this message
  --about              Author and license information
  --version            Display current version number

Examples

Generate a single Sudoku

$ qqwing --generate
 . 4 3 | 5 . . | . . 2
 . . 2 | . . 4 | . 8 3
 . 1 . | . . . | 6 . .
-------|-------|-------
 . 8 . | 7 3 . | . . 5
 2 6 . | . 4 5 | . . .
 1 . . | . . 8 | . . .
-------|-------|-------
 . 7 . | 3 . . | . 6 .
 . . . | . . . | . . .
 . . . | 6 . 7 | . . .

Generate a single Sudoku and print the solution too

$ qqwing --generate --solution
 2 . . | . . 9 | . 8 .
 . 4 6 | . . . | . . .
 7 . . | 4 . 2 | 1 . .
-------|-------|-------
 6 . . | . . 1 | 4 . 8
 . . . | 6 3 . | . 2 .
 9 2 7 | . . . | . . 3
-------|-------|-------
 1 . . | 9 . . | 8 4 .
 . 9 . | . . . | . . .
 4 . . | . . . | . 6 .
 2 3 1 | 7 6 9 | 5 8 4
 5 4 6 | 3 1 8 | 2 9 7
 7 8 9 | 4 5 2 | 1 3 6
-------|-------|-------
 6 5 3 | 2 9 1 | 4 7 8
 8 1 4 | 6 3 7 | 9 2 5
 9 2 7 | 5 8 4 | 6 1 3
-------|-------|-------
 1 6 5 | 9 7 3 | 8 4 2
 3 9 2 | 8 4 6 | 7 5 1
 4 7 8 | 1 2 5 | 3 6 9

Generate ten puzzles and print out full stats in CSV format

$ qqwing --generate 10 --solution --csv --stats --timer
Puzzle,Solution,Time (milliseconds),Givens,Singles,Hidden Singles,Naked Pairs,Hidden Pairs,Pointing Pairs/Triples,Box/Line Intersections,Guesses,Backtracks,Difficulty
.13.....22.....48....7...19...9..8..7......2....3.......263.9..4.9.7.6....149...8,913584762257169483648723519136942857795816324824357196572638941489271635361495278,46.717,26,34,21,0,0,0,0,0,0,Easy,
5...7.6..41..53..7.6712...884.....1.....1.3.6...7...2........65......87..3.......,529478631418653297367129458846532719275914386193786524982347165654291873731865942,30.1,26,55,0,0,0,0,0,0,0,Simple,
...........8..4.1...4.7....8..3...69..71....4.95......4..51.7.3.7.8..9..5....6.8.,712983645938654217654271398841327569267195834395468172486519723173842956529736481,44.492,25,41,13,3,0,1,1,2,2,Expert,
.6..5..3...1.2..5.7....34..426.38.....3.......574.12.......7......81...7....6...1,264159738381724956795683412426538179913276584857491263138947625642815397579362841,28.002,26,55,0,0,0,0,0,0,0,Simple,
...6..4.9..8........3..9.....17.5...8.......1.4.3......3.....561......3..94..8..7,512673489978142563463859712321795648859426371746381295237914856185267934694538127,235.508,22,35,24,1,0,0,0,0,0,Intermediate,
.46...58.718.....65...4....1....675..8.....1..2...58.4.....74...69....7.2....1...,946712583718359246532648197193486752485273619627195834351967428869524371274831965,72.421,27,40,14,0,0,0,0,0,0,Easy,
6.......1...63.....8241...9.....5.1..4.......2.9..8..5..4....8.....2.46.5........,697852341451639278382417659873265914145973826269148735714396582938521467526784193,71.251,22,35,24,0,0,0,0,0,0,Easy,
..28.5..7.9..274......1...9.8....7313........4...71...........4.1.9...........253,142895367893627415756413829685249731371568942429371586238756194514932678967184253,74.806,24,37,20,0,0,0,0,0,0,Easy,
4....791....4.....2..5...365.3....2.....7.1...7.129......9.3...3.5....6.....6....,456237918931486572287591436513648729629375184874129653762953841395814267148762395,76.731,24,40,17,0,0,0,0,0,0,Easy,
........49.1.6.5....8....9.8..4.37.6....1....54...718.....39..7....4..5....7..81.,756981234921364578438572691819453726673218945542697183285139467197846352364725819,75.17,26,43,11,0,0,1,0,1,0,Expert,
10 puzzles generated in 0.757244 seconds.

Generate a puzzle of expert difficulty and print it in compact format

$ qqwing --generate --difficulty expert --compact
8........
......5.7
.......61
.1..869.5
....14...
.965....4
..8..7...
75.3....9
..9..13..

Solve a puzzle

$ echo ........49.1.6.5....8....9.8..4.37.6....1....54...718.....39..7....4..5....7..81. | qqwing --solve
 7 5 6 | 9 8 1 | 2 3 4
 9 2 1 | 3 6 4 | 5 7 8
 4 3 8 | 5 7 2 | 6 9 1
-------|-------|-------
 8 1 9 | 4 5 3 | 7 2 6
 6 7 3 | 2 1 8 | 9 4 5
 5 4 2 | 6 9 7 | 1 8 3
-------|-------|-------
 2 8 5 | 1 3 9 | 4 6 7
 1 9 7 | 8 4 6 | 3 5 2
 3 6 4 | 7 2 5 | 8 1 9

Solve a puzzle and print out complete stats and solve instructions

$ echo .....1.....2....9..1.97.83.7...2.6...81..6.4..9.....2....389.6....71........62... | qqwing --solve --stats --instructions --count-solutions
 9 4 8 | 2 3 1 | 7 5 6
 3 7 2 | 6 5 8 | 1 9 4
 5 1 6 | 9 7 4 | 8 3 2
-------|-------|-------
 7 5 4 | 8 2 3 | 6 1 9
 2 8 1 | 5 9 6 | 3 4 7
 6 9 3 | 1 4 7 | 5 2 8
-------|-------|-------
 1 2 7 | 3 8 9 | 4 6 5
 4 6 9 | 7 1 5 | 2 8 3
 8 3 5 | 4 6 2 | 9 7 1
1. Round: 1 - Mark given (Row: 1 - Column: 6 - Value: 1)
2. Round: 1 - Mark given (Row: 2 - Column: 3 - Value: 2)
3. Round: 1 - Mark given (Row: 2 - Column: 8 - Value: 9)
4. Round: 1 - Mark given (Row: 3 - Column: 2 - Value: 1)
5. Round: 1 - Mark given (Row: 3 - Column: 4 - Value: 9)
6. Round: 1 - Mark given (Row: 3 - Column: 5 - Value: 7)
7. Round: 1 - Mark given (Row: 3 - Column: 7 - Value: 8)
8. Round: 1 - Mark given (Row: 3 - Column: 8 - Value: 3)
9. Round: 1 - Mark given (Row: 4 - Column: 1 - Value: 7)
10. Round: 1 - Mark given (Row: 4 - Column: 5 - Value: 2)
11. Round: 1 - Mark given (Row: 4 - Column: 7 - Value: 6)
12. Round: 1 - Mark given (Row: 5 - Column: 2 - Value: 8)
13. Round: 1 - Mark given (Row: 5 - Column: 3 - Value: 1)
14. Round: 1 - Mark given (Row: 5 - Column: 6 - Value: 6)
15. Round: 1 - Mark given (Row: 5 - Column: 8 - Value: 4)
16. Round: 1 - Mark given (Row: 6 - Column: 2 - Value: 9)
17. Round: 1 - Mark given (Row: 6 - Column: 8 - Value: 2)
18. Round: 1 - Mark given (Row: 7 - Column: 4 - Value: 3)
19. Round: 1 - Mark given (Row: 7 - Column: 5 - Value: 8)
20. Round: 1 - Mark given (Row: 7 - Column: 6 - Value: 9)
21. Round: 1 - Mark given (Row: 7 - Column: 8 - Value: 6)
22. Round: 1 - Mark given (Row: 8 - Column: 4 - Value: 7)
23. Round: 1 - Mark given (Row: 8 - Column: 5 - Value: 1)
24. Round: 1 - Mark given (Row: 9 - Column: 5 - Value: 6)
25. Round: 1 - Mark given (Row: 9 - Column: 6 - Value: 2)
26. Round: 2 - Mark only possibility for cell (Row: 5 - Column: 4 - Value: 5)
27. Round: 2 - Mark only possibility for cell (Row: 9 - Column: 4 - Value: 4)
28. Round: 2 - Mark only possibility for cell (Row: 8 - Column: 6 - Value: 5)
29. Round: 2 - Mark only possibility for cell (Row: 3 - Column: 6 - Value: 4)
30. Round: 2 - Mark only possibility for cell (Row: 8 - Column: 8 - Value: 8)
31. Round: 2 - Mark single possibility for value in section (Row: 1 - Column: 4 - Value: 2)
32. Round: 2 - Mark single possibility for value in section (Row: 2 - Column: 4 - Value: 6)
33. Round: 2 - Mark single possibility for value in section (Row: 2 - Column: 6 - Value: 8)
34. Round: 2 - Mark only possibility for cell (Row: 4 - Column: 6 - Value: 3)
35. Round: 2 - Mark only possibility for cell (Row: 5 - Column: 5 - Value: 9)
36. Round: 2 - Mark only possibility for cell (Row: 6 - Column: 5 - Value: 4)
37. Round: 2 - Mark only possibility for cell (Row: 6 - Column: 6 - Value: 7)
38. Round: 2 - Mark single possibility for value in section (Row: 3 - Column: 9 - Value: 2)
39. Round: 2 - Mark single possibility for value in section (Row: 1 - Column: 9 - Value: 6)
40. Round: 2 - Mark single possibility for value in section (Row: 5 - Column: 1 - Value: 2)
41. Round: 2 - Mark single possibility for value in section (Row: 4 - Column: 9 - Value: 9)
42. Round: 2 - Mark single possibility for value in section (Row: 6 - Column: 9 - Value: 8)
43. Round: 2 - Mark only possibility for cell (Row: 6 - Column: 4 - Value: 1)
44. Round: 2 - Mark only possibility for cell (Row: 4 - Column: 4 - Value: 8)
45. Round: 2 - Mark single possibility for value in section (Row: 4 - Column: 8 - Value: 1)
46. Round: 2 - Mark single possibility for value in section (Row: 6 - Column: 7 - Value: 5)
47. Round: 2 - Mark single possibility for value in column (Row: 8 - Column: 2 - Value: 6)
48. Round: 2 - Mark single possibility for value in section (Row: 7 - Column: 2 - Value: 2)
49. Round: 2 - Mark single possibility for value in section (Row: 8 - Column: 7 - Value: 2)
50. Round: 2 - Mark single possibility for value in section (Row: 9 - Column: 7 - Value: 9)
51. Round: 2 - Mark single possibility for value in column (Row: 5 - Column: 7 - Value: 3)
52. Round: 2 - Mark only possibility for cell (Row: 5 - Column: 9 - Value: 7)
53. Round: 2 - Remove possibilities for naked pair in section (Row: 3 - Column: 1)
54. Round: 2 - Remove possibilities from hidden pair in row (Row: 1 - Column: 1 - Value: 8)
55. Round: 2 - Remove possibilities for column because all values are in one section (Row: 1 - Column: 2 - Value: 7)
56. Round: 3 - Mark guess (start round) (Row: 4 - Column: 3 - Value: 4)
57. Round: 4 - Mark only possibility for cell (Row: 4 - Column: 2 - Value: 5)
58. Round: 4 - Mark only possibility for cell (Row: 9 - Column: 2 - Value: 3)
59. Round: 4 - Mark only possibility for cell (Row: 8 - Column: 3 - Value: 9)
60. Round: 4 - Mark only possibility for cell (Row: 1 - Column: 3 - Value: 8)
61. Round: 4 - Mark only possibility for cell (Row: 1 - Column: 1 - Value: 9)
62. Round: 4 - Mark only possibility for cell (Row: 8 - Column: 1 - Value: 4)
63. Round: 4 - Mark only possibility for cell (Row: 2 - Column: 1 - Value: 3)
64. Round: 4 - Mark only possibility for cell (Row: 2 - Column: 5 - Value: 5)
65. Round: 4 - Mark only possibility for cell (Row: 1 - Column: 5 - Value: 3)
66. Round: 4 - Mark only possibility for cell (Row: 6 - Column: 1 - Value: 6)
67. Round: 4 - Mark only possibility for cell (Row: 3 - Column: 1 - Value: 5)
68. Round: 4 - Mark only possibility for cell (Row: 3 - Column: 3 - Value: 6)
69. Round: 4 - Mark only possibility for cell (Row: 6 - Column: 3 - Value: 3)
70. Round: 4 - Mark only possibility for cell (Row: 7 - Column: 1 - Value: 1)
71. Round: 4 - Mark only possibility for cell (Row: 8 - Column: 9 - Value: 3)
72. Round: 4 - Mark only possibility for cell (Row: 9 - Column: 1 - Value: 8)
73. Round: 4 - Mark single possibility for value in section (Row: 1 - Column: 8 - Value: 5)
74. Round: 4 - Mark only possibility for cell (Row: 9 - Column: 8 - Value: 7)
75. Round: 4 - Mark only possibility for cell (Row: 7 - Column: 7 - Value: 4)
76. Round: 4 - Mark only possibility for cell (Row: 1 - Column: 7 - Value: 7)
77. Round: 4 - Mark only possibility for cell (Row: 1 - Column: 2 - Value: 4)
78. Round: 4 - Mark only possibility for cell (Row: 2 - Column: 2 - Value: 7)
79. Round: 4 - Mark only possibility for cell (Row: 2 - Column: 7 - Value: 1)
80. Round: 4 - Mark only possibility for cell (Row: 2 - Column: 9 - Value: 4)
81. Round: 4 - Mark only possibility for cell (Row: 7 - Column: 9 - Value: 5)
82. Round: 4 - Mark only possibility for cell (Row: 7 - Column: 3 - Value: 7)
83. Round: 4 - Mark only possibility for cell (Row: 9 - Column: 3 - Value: 5)
84. Round: 4 - Mark only possibility for cell (Row: 9 - Column: 9 - Value: 1)
The solution to the puzzle is unique.
Number of Givens: 25
Number of Singles: 39
Number of Hidden Singles: 16
Number of Naked Pairs: 1
Number of Hidden Pairs: 1
Number of Pointing Pairs/Triples: 1
Number of Box/Line Intersections: 0
Number of Guesses: 1
Number of Backtracks: 2
Difficulty: Expert