Hello community, here is the log from the commit of package qqwing for openSUSE:Factory checked in at 2014-08-25 11:05:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qqwing (Old) and /work/SRC/openSUSE:Factory/.qqwing.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qqwing" Changes: -------- --- /work/SRC/openSUSE:Factory/qqwing/qqwing.changes 2014-08-20 10:51:33.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.qqwing.new/qqwing.changes 2014-08-25 11:06:22.000000000 +0200 @@ -1,0 +2,10 @@ +Sat Aug 23 17:58:59 UTC 2014 - zai...@opensuse.org + +- Update to version 1.2.0: + + Javascript version with online generator. + + The JavaScript port powers the online playing board. + + Method for getting the puzzle as an integer array for Gnome + Sudoku. +- Bump so name following upstream changes. + +------------------------------------------------------------------- Old: ---- qqwing-1.1.3.tar.gz New: ---- qqwing-1.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qqwing.spec ++++++ --- /var/tmp/diff_new_pack.fHzucA/_old 2014-08-25 11:06:23.000000000 +0200 +++ /var/tmp/diff_new_pack.fHzucA/_new 2014-08-25 11:06:23.000000000 +0200 @@ -18,7 +18,7 @@ Name: qqwing -Version: 1.1.3 +Version: 1.2.0 Release: 0 Summary: Sudoku solver and generator License: GPL-2.0+ @@ -40,11 +40,11 @@ * Can print solve instructions. Tells steps that need to be taken to solve any puzzle. * Customizable output style. Including a CSV style that is easy to import into a database. -%package -n libqqwing0 +%package -n libqqwing2 Summary: Sudoku solver and generator Group: System/Libraries -%description -n libqqwing0 +%description -n libqqwing2 QQwing is a Sudoku puzzle generator and solver. It offers the following features. * Fast. It can solve 1000 puzzles in 1 second and generate 1000 puzzles in 25 seconds. @@ -56,7 +56,7 @@ %package devel Summary: Sudoku solver and generator Group: Development/Languages/C and C++ -Requires: libqqwing0 = %{version} +Requires: libqqwing2 = %{version} %description devel QQwing is a Sudoku puzzle generator and solver. It offers the following features. @@ -79,16 +79,16 @@ make DESTDIR=%{buildroot} install %{?_smp_mflags} find %{buildroot} -type f -name "*.la" -delete -print -%post -n libqqwing0 -p /sbin/ldconfig +%post -n libqqwing2 -p /sbin/ldconfig -%postun -n libqqwing0 -p /sbin/ldconfig +%postun -n libqqwing2 -p /sbin/ldconfig %files %defattr(-,root,root) %{_bindir}/qqwing %{_mandir}/man1/qqwing.1%{?ext_man} -%files -n libqqwing0 +%files -n libqqwing2 %defattr(-,root,root) %doc README COPYING %{_libdir}/libqqwing.so.* @@ -99,3 +99,4 @@ %{_libdir}/libqqwing.so %{_libdir}/pkgconfig/qqwing.pc +%changelog ++++++ qqwing-1.1.3.tar.gz -> qqwing-1.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqwing-1.1.3/README new/qqwing-1.2.0/README --- old/qqwing-1.1.3/README 2014-08-11 05:01:03.000000000 +0200 +++ new/qqwing-1.2.0/README 2014-08-23 15:11:38.000000000 +0200 @@ -1,8 +1,11 @@ -./qqwing <options> +See: http://ostermiller.org/qqwing/ + +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 + --difficulty <diff> Generate only simple, easy, intermediate, expert, or any + --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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqwing-1.1.3/configure new/qqwing-1.2.0/configure --- old/qqwing-1.1.3/configure 2014-08-11 05:01:09.000000000 +0200 +++ new/qqwing-1.2.0/configure 2014-08-23 15:11:44.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for qqwing 1.1.3. +# Generated by GNU Autoconf 2.69 for qqwing 1.2.0. # # Report bugs to <http://ostermiller.org/qqwing/>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='qqwing' PACKAGE_TARNAME='qqwing' -PACKAGE_VERSION='1.1.3' -PACKAGE_STRING='qqwing 1.1.3' +PACKAGE_VERSION='1.2.0' +PACKAGE_STRING='qqwing 1.2.0' PACKAGE_BUGREPORT='http://ostermiller.org/qqwing/' PACKAGE_URL='' @@ -1324,7 +1324,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures qqwing 1.1.3 to adapt to many kinds of systems. +\`configure' configures qqwing 1.2.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1394,7 +1394,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of qqwing 1.1.3:";; + short | recursive ) echo "Configuration of qqwing 1.2.0:";; esac cat <<\_ACEOF @@ -1502,7 +1502,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -qqwing configure 1.1.3 +qqwing configure 1.2.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2046,7 +2046,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by qqwing $as_me 1.1.3, which was +It was created by qqwing $as_me 1.2.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2406,9 +2406,9 @@ # - If binary compatibility has been broken (eg removed or changed interfaces) # change to C+1:0:0 # - If the interface is the same as the previous version, change to C:R+1:A -QQWING_CURRENT=1 +QQWING_CURRENT=2 QQWING_REVISION=0 -QQWING_AGE=1 +QQWING_AGE=0 @@ -2929,7 +2929,7 @@ # Define the identity of the package. PACKAGE='qqwing' - VERSION='1.1.3' + VERSION='1.2.0' cat >>confdefs.h <<_ACEOF @@ -16177,7 +16177,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by qqwing $as_me 1.1.3, which was +This file was extended by qqwing $as_me 1.2.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16243,7 +16243,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -qqwing config.status 1.1.3 +qqwing config.status 1.2.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqwing-1.1.3/configure.ac new/qqwing-1.2.0/configure.ac --- old/qqwing-1.1.3/configure.ac 2014-08-11 05:01:03.000000000 +0200 +++ new/qqwing-1.2.0/configure.ac 2014-08-23 15:11:38.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ(2.59) -AC_INIT(qqwing, 1.1.3, http://ostermiller.org/qqwing/) +AC_INIT(qqwing, 1.2.0, http://ostermiller.org/qqwing/) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADER([config.h]) @@ -11,9 +11,9 @@ # - If binary compatibility has been broken (eg removed or changed interfaces) # change to C+1:0:0 # - If the interface is the same as the previous version, change to C:R+1:A -QQWING_CURRENT=1 +QQWING_CURRENT=2 QQWING_REVISION=0 -QQWING_AGE=1 +QQWING_AGE=0 AC_SUBST([QQWING_CURRENT]) AC_SUBST([QQWING_REVISION]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqwing-1.1.3/main.cpp new/qqwing-1.2.0/main.cpp --- old/qqwing-1.1.3/main.cpp 2014-08-11 05:01:16.000000000 +0200 +++ new/qqwing-1.2.0/main.cpp 2014-08-23 15:11:51.000000000 +0200 @@ -307,6 +307,7 @@ } } + // Check havePuzzle again, it may have changed based on difficulty if (havePuzzle){ // With a puzzle now in hand and possibly solved diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqwing-1.1.3/qqwing.cpp new/qqwing-1.2.0/qqwing.cpp --- old/qqwing-1.1.3/qqwing.cpp 2014-08-11 05:01:16.000000000 +0200 +++ new/qqwing-1.2.0/qqwing.cpp 2014-08-23 15:11:51.000000000 +0200 @@ -92,7 +92,6 @@ int position; }; - string IntToString(int num); void shuffleArray(int* array, int size); SudokuBoard::Symmetry getRandomSymmetry(); int getLogCount(vector<LogItem*>* v, LogItem::LogType type); @@ -118,13 +117,13 @@ recordHistory = false; printStyle = READABLE; randomBoardArray = new int[BOARD_SIZE]; - randomPossibilityArray = new int[NUM_POSS]; + randomPossibilityArray = new int[ROW_COL_SEC_SIZE]; solveHistory = new vector<LogItem*>(); solveInstructions = new vector<LogItem*>(); {for (int i=0; i<BOARD_SIZE; i++){ randomBoardArray[i] = i; }} - {for (int i=0; i<NUM_POSS; i++){ + {for (int i=0; i<ROW_COL_SEC_SIZE; i++){ randomPossibilityArray[i] = i; }} } @@ -306,7 +305,7 @@ void SudokuBoard::shuffleRandomArrays(){ shuffleArray(randomBoardArray, BOARD_SIZE); - shuffleArray(randomPossibilityArray, NUM_POSS); + shuffleArray(randomPossibilityArray, ROW_COL_SEC_SIZE); } void SudokuBoard::clearPuzzle(){ @@ -363,7 +362,7 @@ // Remove one value at a time and see if // the puzzle still has only one solution. - // If it does, leave it0 out the point because + // If it does, leave it out the point because // it is not needed. {for (int i=0; i<BOARD_SIZE; i++){ // check all the positions, but in shuffled order @@ -374,16 +373,16 @@ int positionsym3 = -1; switch (symmetry){ case ROTATE90: - positionsym2 = rowColumnToCell(COL_HEIGHT-1-cellToColumn(position),cellToRow(position)); - positionsym3 = rowColumnToCell(cellToColumn(position),ROW_LENGTH-1-cellToRow(position)); + positionsym2 = rowColumnToCell(ROW_COL_SEC_SIZE-1-cellToColumn(position),cellToRow(position)); + positionsym3 = rowColumnToCell(cellToColumn(position),ROW_COL_SEC_SIZE-1-cellToRow(position)); case ROTATE180: - positionsym1 = rowColumnToCell(ROW_LENGTH-1-cellToRow(position),COL_HEIGHT-1-cellToColumn(position)); + positionsym1 = rowColumnToCell(ROW_COL_SEC_SIZE-1-cellToRow(position),ROW_COL_SEC_SIZE-1-cellToColumn(position)); break; case MIRROR: - positionsym1 = rowColumnToCell(cellToRow(position),COL_HEIGHT-1-cellToColumn(position)); + positionsym1 = rowColumnToCell(cellToRow(position),ROW_COL_SEC_SIZE-1-cellToColumn(position)); break; case FLIP: - positionsym1 = rowColumnToCell(ROW_LENGTH-1-cellToRow(position),cellToColumn(position)); + positionsym1 = rowColumnToCell(ROW_COL_SEC_SIZE-1-cellToRow(position),cellToColumn(position)); break; } // try backing out the value and @@ -409,9 +408,9 @@ if (countSolutions(2, true) > 1){ // Put it back in, it is needed puzzle[position] = savedValue; - if (positionsym1 >= 0) puzzle[positionsym1] = savedSym1; - if (positionsym2 >= 0) puzzle[positionsym2] = savedSym2; - if (positionsym3 >= 0) puzzle[positionsym3] = savedSym3; + if (positionsym1 >= 0 && savedSym1 != 0) puzzle[positionsym1] = savedSym1; + if (positionsym2 >= 0 && savedSym2 != 0) puzzle[positionsym2] = savedSym2; + if (positionsym3 >= 0 && savedSym3 != 0) puzzle[positionsym3] = savedSym3; } } }} @@ -598,7 +597,7 @@ for (int position=0; position<BOARD_SIZE; position++){ if (solution[position] == 0){ int count = 0; - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0) count++; } @@ -617,7 +616,7 @@ int position = randomBoardArray[i]; if (solution[position] == 0){ int count = 0; - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0) count++; } @@ -633,7 +632,7 @@ bool SudokuBoard::guess(int round, int guessNumber){ int localGuessCount = 0; int position = findPositionWithFewestPossibilities(); - {for (int i=0; i<NUM_POSS; i++){ + {for (int i=0; i<ROW_COL_SEC_SIZE; i++){ int valIndex = randomPossibilityArray[i]; int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0){ @@ -666,14 +665,14 @@ } bool SudokuBoard::colBoxReduction(int round){ - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ - for (int col=0; col<9; col++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ + for (int col=0; col<ROW_COL_SEC_SIZE; col++){ int colStart = columnToFirstCell(col); bool inOneBox = true; int colBox = -1; - {for (int i=0; i<3; i++){ - for (int j=0; j<3; j++){ - int row = i*3+j; + {for (int i=0; i<GRID_SIZE; i++){ + for (int j=0; j<GRID_SIZE; j++){ + int row = i*GRID_SIZE+j; int position = rowColumnToCell(row, col); int valPos = getPossibilityIndex(valIndex,position); if(possibilities[valPos] == 0){ @@ -688,12 +687,12 @@ }} if (inOneBox && colBox != -1){ bool doneSomething = false; - int row = 3*colBox; + int row = GRID_SIZE*colBox; int secStart = cellToSectionStartCell(rowColumnToCell(row, col)); int secStartRow = cellToRow(secStart); int secStartCol = cellToColumn(secStart); - {for (int i=0; i<3; i++){ - for (int j=0; j<3; j++){ + {for (int i=0; i<GRID_SIZE; i++){ + for (int j=0; j<GRID_SIZE; j++){ int row2 = secStartRow+i; int col2 = secStartCol+j; int position = rowColumnToCell(row2, col2); @@ -715,14 +714,14 @@ } bool SudokuBoard::rowBoxReduction(int round){ - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ - for (int row=0; row<9; row++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ + for (int row=0; row<ROW_COL_SEC_SIZE; row++){ int rowStart = rowToFirstCell(row); bool inOneBox = true; int rowBox = -1; - {for (int i=0; i<3; i++){ - for (int j=0; j<3; j++){ - int column = i*3+j; + {for (int i=0; i<GRID_SIZE; i++){ + for (int j=0; j<GRID_SIZE; j++){ + int column = i*GRID_SIZE+j; int position = rowColumnToCell(row, column); int valPos = getPossibilityIndex(valIndex,position); if(possibilities[valPos] == 0){ @@ -737,12 +736,12 @@ }} if (inOneBox && rowBox != -1){ bool doneSomething = false; - int column = 3*rowBox; + int column = GRID_SIZE*rowBox; int secStart = cellToSectionStartCell(rowColumnToCell(row, column)); int secStartRow = cellToRow(secStart); int secStartCol = cellToColumn(secStart); - {for (int i=0; i<3; i++){ - for (int j=0; j<3; j++){ + {for (int i=0; i<GRID_SIZE; i++){ + for (int j=0; j<GRID_SIZE; j++){ int row2 = secStartRow+i; int col2 = secStartCol+j; int position = rowColumnToCell(row2, col2); @@ -764,14 +763,14 @@ } bool SudokuBoard::pointingRowReduction(int round){ - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ - for (int section=0; section<9; section++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ + for (int section=0; section<ROW_COL_SEC_SIZE; section++){ int secStart = sectionToFirstCell(section); bool inOneRow = true; int boxRow = -1; - for (int j=0; j<3; j++){ - {for (int i=0; i<3; i++){ - int secVal=secStart+i+(9*j); + for (int j=0; j<GRID_SIZE; j++){ + {for (int i=0; i<GRID_SIZE; i++){ + int secVal=secStart+i+(ROW_COL_SEC_SIZE*j); int valPos = getPossibilityIndex(valIndex,secVal); if(possibilities[valPos] == 0){ if (boxRow == -1 || boxRow == j){ @@ -787,7 +786,7 @@ int row = cellToRow(secStart) + boxRow; int rowStart = rowToFirstCell(row); - {for (int i=0; i<9; i++){ + {for (int i=0; i<ROW_COL_SEC_SIZE; i++){ int position = rowStart+i; int section2 = cellToSection(position); int valPos = getPossibilityIndex(valIndex,position); @@ -807,14 +806,14 @@ } bool SudokuBoard::pointingColumnReduction(int round){ - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ - for (int section=0; section<9; section++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ + for (int section=0; section<ROW_COL_SEC_SIZE; section++){ int secStart = sectionToFirstCell(section); bool inOneCol = true; int boxCol = -1; - {for (int i=0; i<3; i++){ - for (int j=0; j<3; j++){ - int secVal=secStart+i+(9*j); + {for (int i=0; i<GRID_SIZE; i++){ + for (int j=0; j<GRID_SIZE; j++){ + int secVal=secStart+i+(ROW_COL_SEC_SIZE*j); int valPos = getPossibilityIndex(valIndex,secVal); if(possibilities[valPos] == 0){ if (boxCol == -1 || boxCol == i){ @@ -830,8 +829,8 @@ int col = cellToColumn(secStart) + boxCol; int colStart = columnToFirstCell(col); - {for (int i=0; i<9; i++){ - int position = colStart+(9*i); + {for (int i=0; i<ROW_COL_SEC_SIZE; i++){ + int position = colStart+(ROW_COL_SEC_SIZE*i); int section2 = cellToSection(position); int valPos = getPossibilityIndex(valIndex,position); if (section != section2 && possibilities[valPos] == 0){ @@ -851,7 +850,7 @@ int SudokuBoard::countPossibilities(int position){ int count = 0; - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0) count++; } @@ -859,7 +858,7 @@ } bool SudokuBoard::arePossibilitiesSame(int position1, int position2){ - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int valPos1 = getPossibilityIndex(valIndex,position1); int valPos2 = getPossibilityIndex(valIndex,position2); if ((possibilities[valPos1] == 0 || possibilities[valPos2] == 0) && (possibilities[valPos1] != 0 || possibilities[valPos2] != 0)){ @@ -871,7 +870,7 @@ bool SudokuBoard::removePossibilitiesInOneFromTwo(int position1, int position2, int round){ bool doneSomething = false; - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int valPos1 = getPossibilityIndex(valIndex,position1); int valPos2 = getPossibilityIndex(valIndex,position2); if (possibilities[valPos1] == 0 && possibilities[valPos2] == 0){ @@ -883,12 +882,12 @@ } bool SudokuBoard::hiddenPairInColumn(int round){ - for (int column=0; column<9; column++){ - for (int valIndex=0; valIndex<9; valIndex++){ + for (int column=0; column<ROW_COL_SEC_SIZE; column++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int r1 = -1; int r2 = -1; int valCount = 0; - for (int row=0; row<9; row++){ + for (int row=0; row<ROW_COL_SEC_SIZE; row++){ int position = rowColumnToCell(row,column); int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0){ @@ -901,11 +900,11 @@ } } if (valCount==2){ - for (int valIndex2=valIndex+1; valIndex2<9; valIndex2++){ + for (int valIndex2=valIndex+1; valIndex2<ROW_COL_SEC_SIZE; valIndex2++){ int r3 = -1; int r4 = -1; int valCount2 = 0; - for (int row=0; row<9; row++){ + for (int row=0; row<ROW_COL_SEC_SIZE; row++){ int position = rowColumnToCell(row,column); int valPos = getPossibilityIndex(valIndex2,position); if (possibilities[valPos] == 0){ @@ -919,7 +918,7 @@ } if (valCount2==2 && r1==r3 && r2==r4){ bool doneSomething = false; - for (int valIndex3=0; valIndex3<9; valIndex3++){ + for (int valIndex3=0; valIndex3<ROW_COL_SEC_SIZE; valIndex3++){ if (valIndex3 != valIndex && valIndex3 != valIndex2){ int position1 = rowColumnToCell(r1,column); int position2 = rowColumnToCell(r2,column); @@ -948,12 +947,12 @@ } bool SudokuBoard::hiddenPairInSection(int round){ - for (int section=0; section<9; section++){ - for (int valIndex=0; valIndex<9; valIndex++){ + for (int section=0; section<ROW_COL_SEC_SIZE; section++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int si1 = -1; int si2 = -1; int valCount = 0; - for (int secInd=0; secInd<9; secInd++){ + for (int secInd=0; secInd<ROW_COL_SEC_SIZE; secInd++){ int position = sectionToCell(section,secInd); int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0){ @@ -966,11 +965,11 @@ } } if (valCount==2){ - for (int valIndex2=valIndex+1; valIndex2<9; valIndex2++){ + for (int valIndex2=valIndex+1; valIndex2<ROW_COL_SEC_SIZE; valIndex2++){ int si3 = -1; int si4 = -1; int valCount2 = 0; - for (int secInd=0; secInd<9; secInd++){ + for (int secInd=0; secInd<ROW_COL_SEC_SIZE; secInd++){ int position = sectionToCell(section,secInd); int valPos = getPossibilityIndex(valIndex2,position); if (possibilities[valPos] == 0){ @@ -984,7 +983,7 @@ } if (valCount2==2 && si1==si3 && si2==si4){ bool doneSomething = false; - for (int valIndex3=0; valIndex3<9; valIndex3++){ + for (int valIndex3=0; valIndex3<ROW_COL_SEC_SIZE; valIndex3++){ if (valIndex3 != valIndex && valIndex3 != valIndex2){ int position1 = sectionToCell(section,si1); int position2 = sectionToCell(section,si2); @@ -1013,12 +1012,12 @@ } bool SudokuBoard::hiddenPairInRow(int round){ - for (int row=0; row<9; row++){ - for (int valIndex=0; valIndex<9; valIndex++){ + for (int row=0; row<ROW_COL_SEC_SIZE; row++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int c1 = -1; int c2 = -1; int valCount = 0; - for (int column=0; column<9; column++){ + for (int column=0; column<ROW_COL_SEC_SIZE; column++){ int position = rowColumnToCell(row,column); int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0){ @@ -1031,11 +1030,11 @@ } } if (valCount==2){ - for (int valIndex2=valIndex+1; valIndex2<9; valIndex2++){ + for (int valIndex2=valIndex+1; valIndex2<ROW_COL_SEC_SIZE; valIndex2++){ int c3 = -1; int c4 = -1; int valCount2 = 0; - for (int column=0; column<9; column++){ + for (int column=0; column<ROW_COL_SEC_SIZE; column++){ int position = rowColumnToCell(row,column); int valPos = getPossibilityIndex(valIndex2,position); if (possibilities[valPos] == 0){ @@ -1049,7 +1048,7 @@ } if (valCount2==2 && c1==c3 && c2==c4){ bool doneSomething = false; - for (int valIndex3=0; valIndex3<9; valIndex3++){ + for (int valIndex3=0; valIndex3<ROW_COL_SEC_SIZE; valIndex3++){ if (valIndex3 != valIndex && valIndex3 != valIndex2){ int position1 = rowColumnToCell(row,c1); int position2 = rowColumnToCell(row,c2); @@ -1090,7 +1089,7 @@ if (possibilities2 == 2 && arePossibilitiesSame(position, position2)){ if (row == cellToRow(position2)){ bool doneSomething = false; - for (int column2=0; column2<9; column2++){ + for (int column2=0; column2<ROW_COL_SEC_SIZE; column2++){ int position3 = rowColumnToCell(row,column2); if (position3 != position && position3 != position2 && removePossibilitiesInOneFromTwo(position, position3, round)){ doneSomething = true; @@ -1103,7 +1102,7 @@ } if (column == cellToColumn(position2)){ bool doneSomething = false; - for (int row2=0; row2<9; row2++){ + for (int row2=0; row2<ROW_COL_SEC_SIZE; row2++){ int position3 = rowColumnToCell(row2,column); if (position3 != position && position3 != position2 && removePossibilitiesInOneFromTwo(position, position3, round)){ doneSomething = true; @@ -1117,9 +1116,9 @@ if (section == cellToSectionStartCell(position2)){ bool doneSomething = false; int secStart = cellToSectionStartCell(position); - {for (int i=0; i<3; i++){ - for (int j=0; j<3; j++){ - int position3=secStart+i+(9*j); + {for (int i=0; i<GRID_SIZE; i++){ + for (int j=0; j<GRID_SIZE; j++){ + int position3=secStart+i+(ROW_COL_SEC_SIZE*j); if (position3 != position && position3 != position2 && removePossibilitiesInOneFromTwo(position, position3, round)){ doneSomething = true; } @@ -1145,12 +1144,12 @@ * for one cell. This type of cell is often called a "hidden single" */ bool SudokuBoard::onlyValueInRow(int round){ - for (int row=0; row<ROW_LENGTH; row++){ - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ + for (int row=0; row<ROW_COL_SEC_SIZE; row++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int count = 0; int lastPosition = 0; - for (int col=0; col<COL_HEIGHT; col++){ - int position = (row*ROW_LENGTH)+col; + for (int col=0; col<ROW_COL_SEC_SIZE; col++){ + int position = (row*ROW_COL_SEC_SIZE)+col; int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0){ count++; @@ -1175,11 +1174,11 @@ * for one cell. This type of cell is often called a "hidden single" */ bool SudokuBoard::onlyValueInColumn(int round){ - for (int col=0; col<COL_HEIGHT; col++){ - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ + for (int col=0; col<ROW_COL_SEC_SIZE; col++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int count = 0; int lastPosition = 0; - for (int row=0; row<ROW_LENGTH; row++){ + for (int row=0; row<ROW_COL_SEC_SIZE; row++){ int position = rowColumnToCell(row,col); int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0){ @@ -1205,14 +1204,14 @@ * for one cell. This type of cell is often called a "hidden single" */ bool SudokuBoard::onlyValueInSection(int round){ - for (int sec=0; sec<SEC_COUNT; sec++){ + for (int sec=0; sec<ROW_COL_SEC_SIZE; sec++){ int secPos = sectionToFirstCell(sec); - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int count = 0; int lastPosition = 0; - {for (int i=0; i<3; i++){ - for (int j=0; j<3; j++){ - int position = secPos + i + 9*j; + {for (int i=0; i<GRID_SIZE; i++){ + for (int j=0; j<GRID_SIZE; j++){ + int position = secPos + i + ROW_COL_SEC_SIZE*j; int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0){ count++; @@ -1241,7 +1240,7 @@ if (solution[position] == 0){ int count = 0; int lastValue = 0; - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ + for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0){ count++; @@ -1278,8 +1277,8 @@ // Take this value out of the possibilities for everything in the row solutionRound[position] = round; - int rowStart = cellToRow(position)*9; - for (int col=0; col<COL_HEIGHT; col++){ + int rowStart = cellToRow(position)*ROW_COL_SEC_SIZE; + for (int col=0; col<ROW_COL_SEC_SIZE; col++){ int rowVal=rowStart+col; int valPos = getPossibilityIndex(valIndex,rowVal); //cout << "Row Start: " << rowStart << " Row Value: " << rowVal << " Value Position: " << valPos << endl; @@ -1290,8 +1289,8 @@ // Take this value out of the possibilities for everything in the column int colStart = cellToColumn(position); - {for (int i=0; i<9; i++){ - int colVal=colStart+(9*i); + {for (int i=0; i<ROW_COL_SEC_SIZE; i++){ + int colVal=colStart+(ROW_COL_SEC_SIZE*i); int valPos = getPossibilityIndex(valIndex,colVal); //cout << "Col Start: " << colStart << " Col Value: " << colVal << " Value Position: " << valPos << endl; if (possibilities[valPos] == 0){ @@ -1301,9 +1300,9 @@ // Take this value out of the possibilities for everything in section int secStart = cellToSectionStartCell(position); - {for (int i=0; i<3; i++){ - for (int j=0; j<3; j++){ - int secVal=secStart+i+(9*j); + {for (int i=0; i<GRID_SIZE; i++){ + for (int j=0; j<GRID_SIZE; j++){ + int secVal=secStart+i+(ROW_COL_SEC_SIZE*j); int valPos = getPossibilityIndex(valIndex,secVal); //cout << "Sec Start: " << secStart << " Sec Value: " << secVal << " Value Position: " << valPos << endl; if (possibilities[valPos] == 0){ @@ -1313,42 +1312,12 @@ }} //This position itself is determined, it should have possibilities. - {for (int valIndex=0; valIndex<9; valIndex++){ + {for (int valIndex=0; valIndex<ROW_COL_SEC_SIZE; valIndex++){ int valPos = getPossibilityIndex(valIndex,position); if (possibilities[valPos] == 0){ possibilities[valPos] = round; } }} - - //cout << "Col Start: " << colStart << " Row Start: " << rowStart << " Section Start: " << secStart<< " Value: " << value << endl; - //printPossibilities(); - } - - /** - * Print a human readable list of all the possibilities for the - * squares that have not yet been filled in. - */ - void SudokuBoard::printPossibilities(){ - for(int i=0; i<BOARD_SIZE; i++){ - cout << " "; - for (int valIndex=0; valIndex<NUM_POSS; valIndex++){ - int posVal = (9*i)+valIndex; - int value = valIndex+1; - if (possibilities[posVal]==0){ - cout << value; - } else { - cout << "."; - } - } - if (i != BOARD_SIZE-1 && i%SEC_GROUP_SIZE==SEC_GROUP_SIZE-1){ - cout << endl << "-------------------------------|-------------------------------|-------------------------------" << endl; - } else if (i%9==8){ - cout << endl; - } else if (i%3==2){ - cout << " |"; - } - } - cout << endl; } /** @@ -1375,7 +1344,7 @@ if (printStyle == READABLE || printStyle == COMPACT){ cout << endl; } - } else if (i%9==8){ + } else if (i%ROW_COL_SEC_SIZE==ROW_COL_SEC_SIZE-1){ if (printStyle == READABLE || printStyle == COMPACT){ cout << endl; } @@ -1384,7 +1353,7 @@ cout << "-------|-------|-------" << endl; } } - } else if (i%3==2){ + } else if (i%GRID_SIZE==GRID_SIZE-1){ if (printStyle == READABLE){ cout << " |"; } @@ -1565,7 +1534,7 @@ * the column (0-8) in which that cell resides. */ static inline int cellToColumn(int cell){ - return cell%COL_HEIGHT; + return cell%ROW_COL_SEC_SIZE; } /** @@ -1573,7 +1542,7 @@ * the row (0-8) in which it resides. */ static inline int cellToRow(int cell){ - return cell/ROW_LENGTH; + return cell/ROW_COL_SEC_SIZE; } /** @@ -1600,7 +1569,7 @@ * of that row. */ static inline int rowToFirstCell(int row){ - return 9*row; + return ROW_COL_SEC_SIZE*row; } /** @@ -1625,7 +1594,7 @@ * calculate the offset into the possibility array (0-728). */ static inline int getPossibilityIndex(int valueIndex, int cell){ - return valueIndex+(NUM_POSS*cell); + return valueIndex+(ROW_COL_SEC_SIZE*cell); } /** @@ -1633,7 +1602,7 @@ * cell (0-80). */ static inline int rowColumnToCell(int row, int column){ - return (row*COL_HEIGHT)+column; + return (row*ROW_COL_SEC_SIZE)+column; } /** @@ -1642,7 +1611,7 @@ */ static inline int sectionToCell(int section, int offset){ return sectionToFirstCell(section) - + ((offset/GRID_SIZE)*SEC_SIZE) + + ((offset/GRID_SIZE)*ROW_COL_SEC_SIZE) + (offset%GRID_SIZE); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqwing-1.1.3/qqwing.hpp new/qqwing-1.2.0/qqwing.hpp --- old/qqwing-1.1.3/qqwing.hpp 2014-08-11 05:01:16.000000000 +0200 +++ new/qqwing-1.2.0/qqwing.hpp 2014-08-23 15:11:51.000000000 +0200 @@ -33,14 +33,10 @@ class LogItem; const int GRID_SIZE = 3; - const int ROW_LENGTH = GRID_SIZE*GRID_SIZE; - const int COL_HEIGHT = GRID_SIZE*GRID_SIZE; - const int SEC_SIZE = GRID_SIZE*GRID_SIZE; - const int SEC_COUNT = GRID_SIZE*GRID_SIZE; - const int SEC_GROUP_SIZE = SEC_SIZE*GRID_SIZE; - const int NUM_POSS = GRID_SIZE*GRID_SIZE; - const int BOARD_SIZE = ROW_LENGTH*COL_HEIGHT; - const int POSSIBILITY_SIZE = BOARD_SIZE*NUM_POSS; + const int ROW_COL_SEC_SIZE = GRID_SIZE*GRID_SIZE; + const int SEC_GROUP_SIZE = ROW_COL_SEC_SIZE*GRID_SIZE; + const int BOARD_SIZE = ROW_COL_SEC_SIZE*ROW_COL_SEC_SIZE; + const int POSSIBILITY_SIZE = BOARD_SIZE*ROW_COL_SEC_SIZE; /** * The version of QQwing, e.g. 1.2.3 @@ -82,7 +78,6 @@ void printSolution(); bool solve(); int countSolutions(); - void printPossibilities(); bool isSolved(); void printSolveHistory(); void setRecordHistory(bool recHistory); @@ -107,7 +102,7 @@ private: /** * The 81 integers that make up a sudoku puzzle. - * Givens are 1-9, unknows are 0. + * Givens are 1-9, unknowns are 0. * Once initialized, this puzzle remains as is. * The answer is worked out in "solution". */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqwing-1.1.3/qqwing.pc new/qqwing-1.2.0/qqwing.pc --- old/qqwing-1.1.3/qqwing.pc 2014-08-11 05:01:16.000000000 +0200 +++ new/qqwing-1.2.0/qqwing.pc 2014-08-23 15:11:50.000000000 +0200 @@ -5,6 +5,6 @@ Name: libqqwing Description: Sudoku generator and solver library -Version: 1.1.3 +Version: 1.2.0 Libs: -L${libdir} -lqqwing Cflags: -I${includedir} -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org