Debian Codegraph @

main.cpp

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 /*
2 * qqwing - Sudoku solver and generator
3 * Copyright (C) 2006-2014 Stephen Ostermiller http://ostermiller.org/
4 * Copyright (C) 2007 Jacques Bensimon ([email protected])
5 * Copyright (C) 2011 Jean Guillerez (j.guillerez - orange.fr)
6 * Copyright (C) 2014 Michael Catanzaro ([email protected])
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22 #include "config.h"cxx . . $ `<file>/config.h`/
23
24 #include <cstdio>
25 #include <cstdlib>
26 #include <cstring>
27 #include <iostream>
28
29 #if HAVE_GETTIMEOFDAYcxx . . $ `config.h:8:9`! == 1
30 #include <sys/time.h>
31 #else
32 #include <time.h>
33 #endif
34
35 #include "qqwing.hpp"cxx . . $ `<file>/qqwing.hpp`/
36
37 using namespace qqwing;
38 using namespace std;
39
40 long getMicrosecondscxx . . $ getMicroseconds(da6335ded91d79c2).();
41 bool readPuzzleFromStdIncxx . . $ readPuzzleFromStdIn(18a3c31ed0aa5760).(int* puzzle);
42 void printHelpcxx . . $ printHelp(49f6e7a06ebc5aa8).();
43 void printVersioncxx . . $ printVersion(49f6e7a06ebc5aa8).();
44 void printAboutcxx . . $ printAbout(49f6e7a06ebc5aa8).();
45
46 /**
47 * Main method -- the entry point into the program.
48 * Run with --help as an argument for usage and documentation
49 */
50 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[]){
51 try {
52 // Start time for the application for timing
53 long applicationStartTime = getMicrosecondscxx . . $ getMicroseconds(da6335ded91d79c2).();
54
55 // The number of puzzles solved or generated.
56 int puzzleCount = 0;
57
58 enum Actioncxx . . $ main(afcd3168fc1188a4).Action# {NONEcxx . . $ main(afcd3168fc1188a4).NONE., GENERATEcxx . . $ main(afcd3168fc1188a4).GENERATE., SOLVEcxx . . $ main(afcd3168fc1188a4).SOLVE.};
59
60 // defaults for options
61 bool printPuzzle = false;
62 bool printSolution = false;
63 bool printHistory = false;
64 bool printInstructions = false;
65 bool timer = false;
66 bool countSolutions = false;
67 Actioncxx . . $ main(afcd3168fc1188a4).Action# action = NONEcxx . . $ main(afcd3168fc1188a4).NONE.;
68 bool logHistory = false;
69 SudokuBoardcxx . . $ qqwing/SudokuBoard#::PrintStylecxx . . $ qqwing/SudokuBoard#PrintStyle# printStyle = SudokuBoardcxx . . $ qqwing/SudokuBoard#::READABLEcxx . . $ qqwing/SudokuBoard#READABLE.;
70 int numberToGenerate = 1;
71 bool printStats = false;
72 SudokuBoardcxx . . $ qqwing/SudokuBoard#::Difficultycxx . . $ qqwing/SudokuBoard#Difficulty# difficulty = SudokuBoardcxx . . $ qqwing/SudokuBoard#::UNKNOWNcxx . . $ qqwing/SudokuBoard#UNKNOWN.;
73 SudokuBoardcxx . . $ qqwing/SudokuBoard#::Symmetrycxx . . $ qqwing/SudokuBoard#Symmetry# symmetry = SudokuBoardcxx . . $ qqwing/SudokuBoard#::NONEcxx . . $ qqwing/SudokuBoard#NONE.;
74
75 // Read the arguments and set the options
76 {for (int i=1; i<argc; i++){
77 if (!strcmp(argv[i],"--puzzle")){
78 printPuzzle = true;
79 } else if (!strcmp(argv[i],"--nopuzzle")){
80 printPuzzle = false;
81 } else if (!strcmp(argv[i],"--solution")){
82 printSolution = true;
83 } else if (!strcmp(argv[i],"--nosolution")){
84 printSolution = false;
85 } else if (!strcmp(argv[i],"--history")){
86 printHistory = true;
87 } else if (!strcmp(argv[i],"--nohistory")){
88 printHistory = false;
89 } else if (!strcmp(argv[i],"--instructions")){
90 printInstructions = true;
91 } else if (!strcmp(argv[i],"--noinstructions")){
92 printInstructions = false;
93 } else if (!strcmp(argv[i],"--stats")){
94 printStats = true;
95 } else if (!strcmp(argv[i],"--nostats")){
96 printStats = false;
97 #if HAVE_GETTIMEOFDAYcxx . . $ `config.h:8:9`! == 1
98 } else if (!strcmp(argv[i],"--timer")){
99 timer = true;
100 } else if (!strcmp(argv[i],"--notimer")){
101 timer = false;
102 #endif
103 } else if (!strcmp(argv[i],"--count-solutions")){
104 countSolutions = true;
105 } else if (!strcmp(argv[i],"--nocount-solutions")){
106 countSolutions = false;
107 } else if (!strcmp(argv[i],"--generate")){
108 action = GENERATEcxx . . $ main(afcd3168fc1188a4).GENERATE.;
109 printPuzzle = true;
110 if (i+1 < argc && argv[i+1][0] != '-'){
111 numberToGenerate = atoi(argv[i+1]);
112 if (numberToGenerate <= 0){
113 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Bad number of puzzles to generate: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[i+1] <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
114 return 1;
115 }
116 i++;
117 }
118 } else if (!strcmp(argv[i],"--difficulty")){
119 if (argc <= i+1){
120 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Please specify a difficulty." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
121 return 1;
122 } else if (!strcmp(argv[i+1],"simple")){
123 difficulty = SudokuBoardcxx . . $ qqwing/SudokuBoard#::SIMPLEcxx . . $ qqwing/SudokuBoard#SIMPLE.;
124 } else if (!strcmp(argv[i+1],"easy")){
125 difficulty = SudokuBoardcxx . . $ qqwing/SudokuBoard#::EASYcxx . . $ qqwing/SudokuBoard#EASY.;
126 } else if (!strcmp(argv[i+1],"intermediate")){
127 difficulty = SudokuBoardcxx . . $ qqwing/SudokuBoard#::INTERMEDIATEcxx . . $ qqwing/SudokuBoard#INTERMEDIATE.;
128 } else if (!strcmp(argv[i+1],"expert")){
129 difficulty = SudokuBoardcxx . . $ qqwing/SudokuBoard#::EXPERTcxx . . $ qqwing/SudokuBoard#EXPERT.;
130 } else if (!strcmp(argv[i+1],"any")){
131 difficulty = SudokuBoardcxx . . $ qqwing/SudokuBoard#::UNKNOWNcxx . . $ qqwing/SudokuBoard#UNKNOWN.;
132 } else {
133 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Difficulty expected to be simple, easy, intermediate, expert, or any, not " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[i+1] <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
134 return 1;
135 }
136 i++;
137 } else if (!strcmp(argv[i],"--symmetry")){
138 if (argc <= i+1){
139 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Please specify a symmetry." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
140 return 1;
141 } else if (!strcmp(argv[i+1],"none")){
142 symmetry = SudokuBoardcxx . . $ qqwing/SudokuBoard#::NONEcxx . . $ qqwing/SudokuBoard#NONE.;
143 } else if (!strcmp(argv[i+1],"rotate90")){
144 symmetry = SudokuBoardcxx . . $ qqwing/SudokuBoard#::ROTATE90cxx . . $ qqwing/SudokuBoard#ROTATE90.;
145 } else if (!strcmp(argv[i+1],"rotate180")){
146 symmetry = SudokuBoardcxx . . $ qqwing/SudokuBoard#::ROTATE180cxx . . $ qqwing/SudokuBoard#ROTATE180.;
147 } else if (!strcmp(argv[i+1],"mirror")){
148 symmetry = SudokuBoardcxx . . $ qqwing/SudokuBoard#::MIRRORcxx . . $ qqwing/SudokuBoard#MIRROR.;
149 } else if (!strcmp(argv[i+1],"flip")){
150 symmetry = SudokuBoardcxx . . $ qqwing/SudokuBoard#::FLIPcxx . . $ qqwing/SudokuBoard#FLIP.;
151 } else if (!strcmp(argv[i+1],"random")){
152 symmetry = SudokuBoardcxx . . $ qqwing/SudokuBoard#::RANDOMcxx . . $ qqwing/SudokuBoard#RANDOM.;
153 } else {
154 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Symmetry expected to be none, rotate90, rotate180, mirror, flip, or random, not " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[i+1] <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
155 return 1;
156 }
157 i++;
158 } else if (!strcmp(argv[i],"--solve")){
159 action = SOLVEcxx . . $ main(afcd3168fc1188a4).SOLVE.;
160 printSolution = true;
161 } else if (!strcmp(argv[i],"--log-history")){
162 logHistory = true;
163 } else if (!strcmp(argv[i],"--nolog-history")){
164 logHistory = false;
165 } else if (!strcmp(argv[i],"--one-line")){
166 printStyle=SudokuBoardcxx . . $ qqwing/SudokuBoard#::ONE_LINEcxx . . $ qqwing/SudokuBoard#ONE_LINE.;
167 } else if (!strcmp(argv[i],"--compact")){
168 printStyle=SudokuBoardcxx . . $ qqwing/SudokuBoard#::COMPACTcxx . . $ qqwing/SudokuBoard#COMPACT.;
169 } else if (!strcmp(argv[i],"--readable")){
170 printStyle=SudokuBoardcxx . . $ qqwing/SudokuBoard#::READABLEcxx . . $ qqwing/SudokuBoard#READABLE.;
171 } else if (!strcmp(argv[i],"--csv")){
172 printStyle=SudokuBoardcxx . . $ qqwing/SudokuBoard#::CSVcxx . . $ qqwing/SudokuBoard#CSV.;
173 } else if (!strcmp(argv[i],"-n") || !strcmp(argv[i],"--number")){
174 if (i+1 < argc){
175 numberToGenerate = atoi(argv[i+1]);
176 i++;
177 } else {
178 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Please specify a number." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
179 return 1;
180 }
181 } else if (!strcmp(argv[i],"-h") || !strcmp(argv[i],"--help") || !strcmp(argv[i],"help") || !strcmp(argv[i],"?")){
182 printHelpcxx . . $ printHelp(49f6e7a06ebc5aa8).();
183 return 0;
184 } else if (!strcmp(argv[i],"--version")){
185 printVersioncxx . . $ printVersion(49f6e7a06ebc5aa8).();
186 return 0;
187 } else if (!strcmp(argv[i],"--about")){
188 printAboutcxx . . $ printAbout(49f6e7a06ebc5aa8).();
189 return 0;
190 } else {
191 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Unknown argument: '" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[i] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "'" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
192 printHelpcxx . . $ printHelp(49f6e7a06ebc5aa8).();
193 return 1;
194 }
195 }}
196
197 if (action == NONEcxx . . $ main(afcd3168fc1188a4).NONE.){
198 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Either --solve or --generate must be specified." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
199 printHelpcxx . . $ printHelp(49f6e7a06ebc5aa8).();
200 return 1;
201 }
202
203 // Initialize the random number generator
204 srand ( unsigned ( time(0) ) );
205
206 // If printing out CSV, print a header
207 if (printStyle == SudokuBoardcxx . . $ qqwing/SudokuBoard#::CSVcxx . . $ qqwing/SudokuBoard#CSV.){
208 if (printPuzzle) coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Puzzle,";
209 if (printSolution) coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Solution,";
210 if (printHistory) coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Solve History,";
211 if (printInstructions) coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Solve Instructions,";
212 if (countSolutions) coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Solution Count,";
213 if (timer) coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Time (milliseconds),";
214 if (printStats) coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Givens,Singles,Hidden Singles,Naked Pairs,Hidden Pairs,Pointing Pairs/Triples,Box/Line Intersections,Guesses,Backtracks,Difficulty";
215 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
216 }
217
218 // Create a new puzzle board
219 // and set the options
220 SudokuBoardcxx . . $ qqwing/SudokuBoard#* ss = new SudokuBoardcxx . . $ qqwing/SudokuBoard#();
221 ss->setRecordHistorycxx . . $ qqwing/SudokuBoard#setRecordHistory(b45ddcbc8423892c).(printHistory || printInstructions || printStats || difficulty!=SudokuBoardcxx . . $ qqwing/SudokuBoard#::UNKNOWNcxx . . $ qqwing/SudokuBoard#UNKNOWN.);
222 ss->setLogHistorycxx . . $ qqwing/SudokuBoard#setLogHistory(b45ddcbc8423892c).(logHistory);
223 ss->setPrintStylecxx . . $ qqwing/SudokuBoard#setPrintStyle(d669926821d8d926).(printStyle);
224
225 // Solve puzzle or generate puzzles
226 // until end of input for solving, or
227 // until we have generated the specified number.
228 bool done = false;
229 int numberGenerated = 0;
230 while (!done){
231 // record the start time for the timer.
232 long puzzleStartTime = getMicrosecondscxx . . $ getMicroseconds(da6335ded91d79c2).();
233
234 // iff something has been printed for this particular puzzle
235 bool printedSomething = false;
236
237 // Record whether the puzzle was possible or not,
238 // so that we don't try to solve impossible givens.
239 bool havePuzzle = false;
240 if (action == GENERATEcxx . . $ main(afcd3168fc1188a4).GENERATE.){
241 // Generate a puzzle
242 havePuzzle = ss->generatePuzzleSymmetrycxx . . $ qqwing/SudokuBoard#generatePuzzleSymmetry(5cd0e10cf5c8b28a).(symmetry);
243 if (!havePuzzle && printPuzzle){
244 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Could not generate puzzle.";
245 if (printStyle==SudokuBoardcxx . . $ qqwing/SudokuBoard#::CSVcxx . . $ qqwing/SudokuBoard#CSV.){
246 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ",";
247 } else {
248 coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
249 }
250 printedSomething = true;
251 }
252 } else {
253 // Read the next puzzle on STDIN
254 int* puzzle = new int[BOARD_SIZEcxx . . $ qqwing/BOARD_SIZE.];
255 if (readPuzzleFromStdIncxx . . $ readPuzzleFromStdIn(18a3c31ed0aa5760).(puzzle)){
256 havePuzzle = ss->setPuzzlecxx . . $ qqwing/SudokuBoard#setPuzzle(18a3c31ed0aa5760).(puzzle);
257 if (!havePuzzle){
258 if (printPuzzle){
259 ss->printPuzzlecxx . . $ qqwing/SudokuBoard#printPuzzle(49f6e7a06ebc5aa8).();
260 printedSomething = true;
261 }
262 if (printSolution) {
263 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Puzzle is not possible.";
264 if (printStyle==SudokuBoardcxx . . $ qqwing/SudokuBoard#::CSVcxx . . $ qqwing/SudokuBoard#CSV.){
265 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ",";
266 } else {
267 coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
268 }
269 printedSomething = true;
270 }
271 }
272 } else {
273 // Set loop to terminate when nothing is left on STDIN
274 havePuzzle = false;
275 done = true;
276 }
277 delete[] puzzle;
278 }
279
280 int solutions = 0;
281
282 if (havePuzzle){
283
284 // Count the solutions if requested.
285 // (Must be done before solving, as it would
286 // mess up the stats.)
287 if (countSolutions){
288 solutions = ss->countSolutionscxx . . $ qqwing/SudokuBoard#countSolutions(b126dc7c1de90089).();
289 }
290
291 // Solve the puzzle
292 if (printSolution || printHistory || printStats || printInstructions || difficulty!=SudokuBoardcxx . . $ qqwing/SudokuBoard#::UNKNOWNcxx . . $ qqwing/SudokuBoard#UNKNOWN.){
293 ss->solvecxx . . $ qqwing/SudokuBoard#solve(c9857a73d68e59ba).();
294 }
295
296 // Bail out if it didn't meet the difficulty standards for generation
297 if (action == GENERATEcxx . . $ main(afcd3168fc1188a4).GENERATE.){
298 if (difficulty!=SudokuBoardcxx . . $ qqwing/SudokuBoard#::UNKNOWNcxx . . $ qqwing/SudokuBoard#UNKNOWN. && difficulty!=ss->getDifficultycxx . . $ qqwing/SudokuBoard#getDifficulty(d24da0b16ec1332b).()){
299 havePuzzle = false;
300 } else {
301 numberGenerated++;
302 // Set loop to terminate if enough have been generated.
303 if (numberGenerated >= numberToGenerate) done = true;
304 }
305 }
306 }
307
308 // Check havePuzzle again, it may have changed based on difficulty
309 if (havePuzzle){
310
311 // With a puzzle now in hand and possibly solved
312 // print out the solution, stats, etc.
313 printedSomething = true;
314
315 // Record the end time for the timer.
316 long puzzleDoneTime = getMicrosecondscxx . . $ getMicroseconds(da6335ded91d79c2).();
317
318 // Print the puzzle itself.
319 if (printPuzzle) ss->printPuzzlecxx . . $ qqwing/SudokuBoard#printPuzzle(49f6e7a06ebc5aa8).();
320
321 // Print the solution if there is one
322 if (printSolution){
323 if (ss->isSolvedcxx . . $ qqwing/SudokuBoard#isSolved(c9857a73d68e59ba).()){
324 ss->printSolutioncxx . . $ qqwing/SudokuBoard#printSolution(49f6e7a06ebc5aa8).();
325 } else {
326 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Puzzle has no solution.";
327 if (printStyle==SudokuBoardcxx . . $ qqwing/SudokuBoard#::CSVcxx . . $ qqwing/SudokuBoard#CSV.){
328 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ",";
329 } else {
330 coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
331 }
332 }
333 }
334
335 // Print the steps taken to solve or attempt to solve the puzzle.
336 if (printHistory) ss->printSolveHistorycxx . . $ qqwing/SudokuBoard#printSolveHistory(49f6e7a06ebc5aa8).();
337 // Print the instructions for solving the puzzle
338 if (printInstructions) ss->printSolveInstructionscxx . . $ qqwing/SudokuBoard#printSolveInstructions(49f6e7a06ebc5aa8).();
339
340 // Print the number of solutions to the puzzle.
341 if (countSolutions){
342 if (printStyle == SudokuBoardcxx . . $ qqwing/SudokuBoard#::CSVcxx . . $ qqwing/SudokuBoard#CSV.){
343 coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). solutions <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ",";
344 } else {
345 if (solutions == 0){
346 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "There are no solutions to the puzzle." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
347 } else if (solutions == 1){
348 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "The solution to the puzzle is unique." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
349 } else {
350 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "There are " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). solutions <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " solutions to the puzzle." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
351 }
352 }
353 }
354
355 // Print out the time it took to solve the puzzle.
356 if (timer){
357 double t = ((double)(puzzleDoneTime - puzzleStartTime))/1000.0;
358 if (printStyle == SudokuBoardcxx . . $ qqwing/SudokuBoard#::CSVcxx . . $ qqwing/SudokuBoard#CSV.){
359 coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). t <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ",";
360 } else {
361 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Time: " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). t <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " milliseconds" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
362 }
363 }
364
365 // Print any stats we were able to gather while solving the puzzle.
366 if (printStats){
367 int givenCount = ss->getGivenCountcxx . . $ qqwing/SudokuBoard#getGivenCount(b126dc7c1de90089).();
368 int singleCount = ss->getSingleCountcxx . . $ qqwing/SudokuBoard#getSingleCount(b126dc7c1de90089).();
369 int hiddenSingleCount = ss->getHiddenSingleCountcxx . . $ qqwing/SudokuBoard#getHiddenSingleCount(b126dc7c1de90089).();
370 int nakedPairCount = ss->getNakedPairCountcxx . . $ qqwing/SudokuBoard#getNakedPairCount(b126dc7c1de90089).();
371 int hiddenPairCount = ss->getHiddenPairCountcxx . . $ qqwing/SudokuBoard#getHiddenPairCount(b126dc7c1de90089).();
372 int pointingPairTripleCount = ss->getPointingPairTripleCountcxx . . $ qqwing/SudokuBoard#getPointingPairTripleCount(b126dc7c1de90089).();
373 int boxReductionCount = ss->getBoxLineReductionCountcxx . . $ qqwing/SudokuBoard#getBoxLineReductionCount(b126dc7c1de90089).();
374 int guessCount = ss->getGuessCountcxx . . $ qqwing/SudokuBoard#getGuessCount(b126dc7c1de90089).();
375 int backtrackCount = ss->getBacktrackCountcxx . . $ qqwing/SudokuBoard#getBacktrackCount(b126dc7c1de90089).();
376 stringcxx . . $ std/string# difficultyString = ss->getDifficultyAsStringcxx . . $ qqwing/SudokuBoard#getDifficultyAsString(efd28698952f529a).();
377 if (printStyle == SudokuBoardcxx . . $ qqwing/SudokuBoard#::CSVcxx . . $ qqwing/SudokuBoard#CSV.){
378 coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). givenCount <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). singleCount <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). hiddenSingleCount
379 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). nakedPairCount <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). hiddenPairCount
380 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). pointingPairTripleCount <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). boxReductionCount
381 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). guessCount <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). backtrackCount
382 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/`operator<<`(88df5bef833f7f83). difficultyString <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ",";
383 } else {
384 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Givens: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). givenCount <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
385 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Singles: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). singleCount <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
386 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Hidden Singles: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). hiddenSingleCount <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
387 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Naked Pairs: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). nakedPairCount <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
388 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Hidden Pairs: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). hiddenPairCount <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
389 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Pointing Pairs/Triples: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). pointingPairTripleCount <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
390 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Box/Line Intersections: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). boxReductionCount <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
391 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Guesses: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). guessCount <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
392 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Backtracks: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). backtrackCount <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
393 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Difficulty: " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). difficultyString <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
394 }
395 }
396 puzzleCount++;
397 }
398 if (printedSomething && printStyle == SudokuBoardcxx . . $ qqwing/SudokuBoard#::CSVcxx . . $ qqwing/SudokuBoard#CSV.){
399 coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
400 }
401 }
402
403 delete ss;
404
405 long applicationDoneTime = getMicrosecondscxx . . $ getMicroseconds(da6335ded91d79c2).();
406 // Print out the time it took to do everything
407 if (timer){
408 double t = ((double)(applicationDoneTime - applicationStartTime))/1000000.0;
409 coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). puzzleCount <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " puzzle" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ((puzzleCount==1)?"":"s") <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (action==GENERATEcxx . . $ main(afcd3168fc1188a4).GENERATE.?"generated":"solved") <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " in " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). t <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " seconds." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
410 }
411
412
413 } catch (char const* s){
414 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). s <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
415 return 1;
416 }
417
418 return 0;
419 }
420
421 void printVersioncxx . . $ printVersion(49f6e7a06ebc5aa8).(){
422 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). PACKAGE_STRINGcxx . . $ `config.h:60:9`! <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
423 }
424
425 void printAboutcxx . . $ printAbout(49f6e7a06ebc5aa8).(){
426 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "qqwing - Sudoku solver and generator" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
427 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Copyright (C) 2006-2014 Stephen Ostermiller http://ostermiller.org/" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
428 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Copyright (C) 2007 Jacques Bensimon ([email protected])" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
429 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Copyright (C) 2011 Jean Guillerez (j.guillerez - orange.fr)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
430 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Copyright (C) 2014 Michael Catanzaro ([email protected])" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
431 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
432 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "This program is free software; you can redistribute it and/or modify" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
433 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "it under the terms of the GNU General Public License as published by" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
434 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "the Free Software Foundation; either version 2 of the License, or" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
435 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "(at your option) any later version." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
436 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
437 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "This program is distributed in the hope that it will be useful," <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
438 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "but WITHOUT ANY WARRANTY; without even the implied warranty of" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
439 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
440 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "GNU General Public License for more details." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
441 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
442 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "You should have received a copy of the GNU General Public License along" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
443 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "with this program; if not, write to the Free Software Foundation, Inc.," <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
444 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
445 }
446
447 void printHelpcxx . . $ printHelp(49f6e7a06ebc5aa8).(){
448 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "qqwing <options>" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
449 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Sudoku solver and generator." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
450 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --generate <num> Generate new puzzles" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
451 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --solve Solve all the puzzles from standard input" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
452 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --difficulty <diff> Generate only simple, easy, intermediate, expert, or any" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
453 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --symmetry <sym> Symmetry: none, rotate90, rotate180, mirror, flip, or random" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
454 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --puzzle Print the puzzle (default when generating)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
455 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --nopuzzle Do not print the puzzle (default when solving)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
456 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --solution Print the solution (default when solving)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
457 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --nosolution Do not print the solution (default when generating)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
458 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --stats Print statistics about moves used to solve the puzzle" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
459 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --nostats Do not print statistics (default)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
460 #if HAVE_GETTIMEOFDAYcxx . . $ `config.h:8:9`! == 1
461 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --timer Print time to generate or solve each puzzle" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
462 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --notimer Do not print solve or generation times (default)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
463 #endif
464 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --count-solutions Count the number of solutions to puzzles" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
465 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --nocount-solutions Do not count the number of solutions (default)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
466 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --history Print trial and error used when solving" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
467 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --nohistory Do not print trial and error to solve (default)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
468 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --instructions Print the steps (at least 81) needed to solve the puzzle" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
469 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --noinstructions Do not print steps to solve (default)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
470 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --log-history Print trial and error to solve as it happens" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
471 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --nolog-history Do not print trial and error to solve as it happens" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
472 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --one-line Print puzzles on one line of 81 characters" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
473 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --compact Print puzzles on 9 lines of 9 characters" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
474 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --readable Print puzzles in human readable form (default)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
475 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --csv Output CSV format with one line puzzles" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
476 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --help Print this message" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
477 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --about Author and license information" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
478 coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --version Display current version number" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).;
479 }
480
481 /**
482 * Read a sudoku puzzle from standard input.
483 * STDIN is processed one character at a time
484 * until the sudoku is filled in. Any digit
485 * or period is used to fill the sudoku, any
486 * other character is ignored.
487 */
488 bool readPuzzleFromStdIncxx . . $ readPuzzleFromStdIn(18a3c31ed0aa5760).(int* puzzle){
489 int read = 0;
490 while (read < BOARD_SIZEcxx . . $ qqwing/BOARD_SIZE.){
•491 int c = getchar();
492 if (c == EOFcxx . . $ `<external>/232824719582829767/stdio.h:105:9`!) return false;
493 if (c >= '1' && c <='9'){
494 puzzle[read] = c-'0';
495 read++;
496 }
497 if (c == '.' || c == '0'){
498 puzzle[read] = 0;
499 read++;
500 }
501 }
502 return true;
503 }
504
505 /**
506 * Get the current time in microseconds.
507 */
508 long getMicrosecondscxx . . $ getMicroseconds(da6335ded91d79c2).(){
509 #if HAVE_GETTIMEOFDAYcxx . . $ `config.h:8:9`! == 1
510 struct timeval tv;
511 gettimeofday(&tv, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
512 return tv.tv_sec*1000000+tv.tv_usec;
513 #else
514 return 0;
515 #endif
516 }