From f3ee37383f4874c6aeab754c59284bf39c65d7fb Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 12 Jul 2013 22:24:58 +0000 Subject: These had to be into the previous commit. --- README | 26 +++++----- TODO | 21 ++++---- configure.ac | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 143 ----------------------------------------------------- 4 files changed, 183 insertions(+), 166 deletions(-) create mode 100644 configure.ac delete mode 100644 configure.in diff --git a/README b/README index 4f2227e..c038caa 100644 --- a/README +++ b/README @@ -1,11 +1,11 @@ -INGAR'S SUDOKU SOLVER +INGAR'S SUDOKU SOLVER - README I'm not a fervent sudoku solver but I always wanted to try implementing a program to solve the puzzles faster than I can. This is my first attempt. This program uses the Qt 4.x library for its user interface, you will need - to have it installed to run the program. + to have it installed to build or run the program. BUILDING INSTRUCTIONS @@ -25,7 +25,7 @@ BUILDING INSTRUCTIONS USAGE Running the program will show the main window, which consists of a basic - sudoku grid (9x9) and a number of menu options. + 9x9 sudoku grid and a number of menu options. GAME menu @@ -43,10 +43,10 @@ USAGE MOVE menu - The STEP option will solve a single random empty cell, + The STEP option will try to solve a single random unsolved cell, using the sudoku rules only. - The GUESS option will solve a single random empty cell, + The GUESS option will try to solve a single random unsolved cell, and will guess (search) for a solution as required. The SOLVE RULES option will try to solve the game, @@ -60,8 +60,8 @@ USAGE SAVE GAME FILE FORMAT The file format is extremely simple: the files can be opened and edited - with a text editor. Note that empty (unsolved) positions are saved as well. - Value 0 indicates an empty cell. + with a text editor. Note that unsolved positions are saved too + and are indicated by zeroes. Example: @@ -79,7 +79,7 @@ SAVE GAME FILE FORMAT While the file format is optimized for readability, the program will actually ignore extra whitespace while loading a file. This allows you to - load games from a simple file with numbers. + load games from a simple file with a sequence if 81 numbers. ALGORITHM @@ -89,15 +89,15 @@ ALGORITHM and the sudoko inclusion rules, where every number has to appear exactly once in every row, column and subgrid, - The search solver will apply constraints until there no more cells left with just one possibility. - From there, it will pick a random empty cell and fill it with one of the remaining possibilities. + The search solver will apply constraints until there are no cells left with a unique solution. + From there, it will pick a random unsolved cell and fill it with one of the remaining possibilities. From there it recurses into the next iteration. COPYRIGHT This sudoku solver was written by Stijn "Ingar" Buys and is available under - the terms and conditions of the GNU Public License (GPL). + the terms and conditions of the GNU Public License, version 3 or higher. Copyright (c) 2012-2013 - ingar@telenet.be - htpt://ingar.satgnu.net + ingar@osirion.org + http://ingar.satgnu.net diff --git a/TODO b/TODO index ded2f9b..d92bf80 100644 --- a/TODO +++ b/TODO @@ -1,12 +1,13 @@ -- Add Help->About -- Add confirm dialgs on Quit and New -- Mark invalid input -- [VERIFY] Have the options in the Move menu call validate() before solving. -- [VERIFY] Incorporate validate() into the menu +INGAR'S SUDOKU SOLVER - TODO -- [SOLVED] Remove sidebar buttons - -- [SOLVED] Move->Step solves rules only. Have it search for a solution - and pick a solved cell. -* Added Move->Guess + - Add Game->Settings (colors, homepath) + + - [SOLVED] Add confirm dialgs on Quit and New + - [SOLVED] Remove sidebar buttons + - [SOLVED] Move->Step solves rules only. Have it search for a solution and pick a solved cell. + Solved by adding the Move->Guess option. + - [SOLVED] Mark invalid input + - [SOLVED] Add Help->About + - [SOLVED] Incorporate validate() into the menu + - [SOLVED] Incorporate validate() into the menuHave the options in the Move menu call validate() before solving diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..a0978d7 --- /dev/null +++ b/configure.ac @@ -0,0 +1,159 @@ +dnl +dnl configure.in for Ingar's Sudoku Solver +dnl +dnl see also http://qtnode.net/wiki/Qt_with_autotools +dnl + +AC_INIT([Sudoku Solver], [0.1.0], [ingar@osirion.org], [sudoku]) + +AC_CONFIG_HEADERS(src/config.h) + +AM_INIT_AUTOMAKE +AC_PROG_CC +AC_PROG_CXX + +dnl +dnl Qt installation prefix +dnl +AC_MSG_CHECKING(Qt installation prefix) +QTDIR=xxx +AC_ARG_WITH([qt-prefix], + AC_HELP_STRING([--with-qt-prefix=], [to specify the path to the Qt-4.8.0 installation prefix.]), + [QTPATHS="$withval"], + [QTPATHS="/usr /usr/qt4 /opt/qt4"]) + +for x in $QTPATHS; do + if test -d $x ; then + QTDIR="$x" + fi +done +if test $QTDIR = xxx ; then + AC_MSG_ERROR(Could not locate QT 4.1) +fi +AC_MSG_RESULT($QTDIR) + +dnl +dnl Qt includes directory +dnl +AC_MSG_CHECKING(Qt includes directory) + +AC_ARG_WITH([qt-includes], + AC_HELP_STRING([--with-qt-includes=], [to specify the path to directory containing the the Qt-4.8.0 includes.]), + [QTINCLUDEDIR="$withval"], + [QTINCLUDEDIR="$QTDIR/include"]) +AC_MSG_RESULT($QTINCLUDEDIR) + +dnl +dnl libraries directory +dnl +AC_MSG_CHECKING(Qt libraries directory) +AC_ARG_WITH([qt-libraries], + AC_HELP_STRING([--with-qt-libraries=], [to specify the path to directory containing the the Qt-4.8.0 libraries.]), + [QTLIBDIR="$withval"], + [QTLIBDIR="$QTDIR/lib"]) +AC_MSG_RESULT($QTLIBDIR) + +host=`uname -a` # AC_CANONICAL_HOST is broken at the time of this writing. +case $host in + MINGW32*) + AC_MSG_NOTICE(win32) + QTLIBS="-L$QTLIBDIR -lgdi32 -luser32 -lmingw32 -lqtmain -lQtGui4 -lQtCore4 -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows" + QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtCore -I$QTINCLUDEDIR/QtGui -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -frtti -fexceptions" + QTBIN="$QTDIR/bin" + ;; + *) + AC_MSG_NOTICE(generic UNIX) + AC_PATH_XTRA + QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtGui -I$QTINCLUDEDIR/QtCore $X_CFLAGS -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED" + QTLIBS="-Wl,-rpath,QTLIBDIR -L$QTLIBDIR -lQtGui -lQtCore -lpthread" + QTBIN="$QTDIR/bin" + ;; +esac + +LIBS="$LIBS $QTLIBS" +INCLUDES="$INCLUDES $QTINC" +PATH="$PATH:$QTBIN" +CXXFLAGS="$CXXFLAGS $QTINC" + +# Now we check whether we can actually build a Qt app. +cat > myqt.h << EOF +#include +class Test : public QObject +{ +Q_OBJECT +public: + Test() {} + ~Test() {} +public slots: + void receive() {} +signals: + void send(); +}; +EOF + +cat > myqt.cpp << EOF +#include "myqt.h" +#include +int main( int argc, char **argv ) +{ + QApplication app( argc, argv ); + Test t; + QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) ); +} +EOF + +AC_MSG_CHECKING(does moc work) +bnv_try_1="moc myqt.h -o moc_myqt.cpp" +AC_TRY_EVAL(bnv_try_1) +if test x"$ac_status" != x0; then + AC_MSG_ERROR(moc doesn't work) +fi +AC_MSG_RESULT(yes) +AC_MSG_CHECKING(can I compile moc_myqt.cpp) +bnv_try_2="$CXX -c $CXXFLAGS -o moc_myqt.o moc_myqt.cpp" +AC_TRY_EVAL(bnv_try_2) +if test x"$ac_status" != x0; then + AC_MSG_ERROR(couldn't compile moc_myqt.cpp) +fi +AC_MSG_RESULT(yes) +AC_MSG_CHECKING(can I compile myqt.cpp) +bnv_try_3="$CXX $QTINC -c $CXXFLAGS -o myqt.o myqt.cpp" +AC_TRY_EVAL(bnv_try_3) +if test x"$ac_status" != x0; then + AC_MSG_ERROR(couldn't compile myqt.cpp) +fi +AC_MSG_RESULT(yes) +AC_MSG_CHECKING(can I link against QT) +nv_try_4="$CXX $LIBS -o myqt myqt.o moc_myqt.o" +AC_TRY_EVAL(bnv_try_4) +if test x"$ac_status" != x0; then + AC_MSG_ERROR(couldn't link) +fi +AC_MSG_RESULT(yes) + +AC_MSG_CHECKING(for mkoctfile) +AC_TRY_EVAL(mkoctfile) +if test x"$ac_status" != x0; then + AC_MSG_ERROR(mkoctfile is not in the path) +fi +AC_MSG_RESULT(yes) +rm -f moc_myqt.cpp myqt.h myqt.cpp myqt.o myqt moc_myqt.o + +AC_CONFIG_FILES(Makefile src/Makefile) +AC_OUTPUT + +AC_MSG_RESULT([ + +$PACKAGE_STRING + +Configuration summary: + +platform .................. $host +installation prefix ....... $prefix + +includes .................. $INCLUDES +libraries ................. $LIBS +preprocessor flags ........ $CXXFLAGS +compiler flags ............ $CXXFLAGS + +]) \ No newline at end of file diff --git a/configure.in b/configure.in deleted file mode 100644 index 0e9067a..0000000 --- a/configure.in +++ /dev/null @@ -1,143 +0,0 @@ -dnl -dnl configure.in for the sudoku solver -dnl -dnl see also http://qtnode.net/wiki/Qt_with_autotools -dnl - -AC_INIT(editor,0.1) - -AC_CONFIG_HEADERS(src/config.h) - -AM_INIT_AUTOMAKE -AC_PROG_CC -AC_PROG_CXX - -dnl -dnl Qt installation prefix -dnl -AC_MSG_CHECKING(Qt installation prefix) -QTDIR=xxx -AC_ARG_WITH([qt-prefix], - AC_HELP_STRING([--with-qt-prefix=], [to specify the path to the Qt-4.8.0 installation prefix.]), - [QTPATHS="$withval"], - [QTPATHS="/usr /usr/qt4 /opt/qt4"]) - -for x in $QTPATHS; do - if test -d $x ; then - QTDIR="$x" - fi -done -if test $QTDIR = xxx ; then - AC_MSG_ERROR(Could not locate QT 4.1) -fi -AC_MSG_RESULT($QTDIR) - -dnl -dnl Qt includes directory -dnl -AC_MSG_CHECKING(Qt includes directory) - -AC_ARG_WITH([qt-includes], - AC_HELP_STRING([--with-qt-includes=], [to specify the path to directory containing the the Qt-4.8.0 includes.]), - [QTINCLUDEDIR="$withval"], - [QTINCLUDEDIR="$QTDIR/include"]) -AC_MSG_RESULT($QTINCLUDEDIR) - -dnl -dnl libraries directory -dnl -AC_MSG_CHECKING(Qt libraries directory) -AC_ARG_WITH([qt-libraries], - AC_HELP_STRING([--with-qt-libraries=], [to specify the path to directory containing the the Qt-4.8.0 libraries.]), - [QTLIBDIR="$withval"], - [QTLIBDIR="$QTDIR/lib"]) -AC_MSG_RESULT($QTLIBDIR) - -host=`uname -a` # AC_CANONICAL_HOST is broken at the time of this writing. -case $host in - MINGW32*) - AC_MSG_NOTICE(win32) - QTLIBS="-L$QTLIBDIR -lgdi32 -luser32 -lmingw32 -lqtmain -lQtGui4 -lQtCore4 -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows" - QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtCore -I$QTINCLUDEDIR/QtGui -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -frtti -fexceptions" - QTBIN="$QTDIR/bin" - ;; - *) - AC_MSG_NOTICE(generic UNIX) - AC_PATH_XTRA - QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtGui -I$QTINCLUDEDIR/QtCore $X_CFLAGS -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED" - QTLIBS="-Wl,-rpath,QTLIBDIR -L$QTLIBDIR -lQtGui -lQtCore -lpthread" - QTBIN="$QTDIR/bin" - ;; -esac - -LIBS="$LIBS $QTLIBS" -INCLUDES="$INCLUDES $QTINC" -PATH="$PATH:$QTBIN" -CXXFLAGS="$CXXFLAGS $QTINC" - -# Now we check whether we can actually build a Qt app. -cat > myqt.h << EOF -#include -class Test : public QObject -{ -Q_OBJECT -public: - Test() {} - ~Test() {} -public slots: - void receive() {} -signals: - void send(); -}; -EOF - -cat > myqt.cpp << EOF -#include "myqt.h" -#include -int main( int argc, char **argv ) -{ - QApplication app( argc, argv ); - Test t; - QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) ); -} -EOF - -AC_MSG_CHECKING(does moc work) -bnv_try_1="moc myqt.h -o moc_myqt.cpp" -AC_TRY_EVAL(bnv_try_1) -if test x"$ac_status" != x0; then - AC_MSG_ERROR(moc doesn't work) -fi -AC_MSG_RESULT(yes) -AC_MSG_CHECKING(can I compile moc_myqt.cpp) -bnv_try_2="$CXX -c $CXXFLAGS -o moc_myqt.o moc_myqt.cpp" -AC_TRY_EVAL(bnv_try_2) -if test x"$ac_status" != x0; then - AC_MSG_ERROR(couldn't compile moc_myqt.cpp) -fi -AC_MSG_RESULT(yes) -AC_MSG_CHECKING(can I compile myqt.cpp) -bnv_try_3="$CXX $QTINC -c $CXXFLAGS -o myqt.o myqt.cpp" -AC_TRY_EVAL(bnv_try_3) -if test x"$ac_status" != x0; then - AC_MSG_ERROR(couldn't compile myqt.cpp) -fi -AC_MSG_RESULT(yes) -AC_MSG_CHECKING(can I link against QT) -nv_try_4="$CXX $LIBS -o myqt myqt.o moc_myqt.o" -AC_TRY_EVAL(bnv_try_4) -if test x"$ac_status" != x0; then - AC_MSG_ERROR(couldn't link) -fi -AC_MSG_RESULT(yes) - -AC_MSG_CHECKING(for mkoctfile) -AC_TRY_EVAL(mkoctfile) -if test x"$ac_status" != x0; then - AC_MSG_ERROR(mkoctfile is not in the path) -fi -AC_MSG_RESULT(yes) -rm -f moc_myqt.cpp myqt.h myqt.cpp myqt.o myqt moc_myqt.o - -AC_CONFIG_FILES(Makefile src/Makefile) -AC_OUTPUT -- cgit v1.2.3