t-dillon / tdoku

A fast Sudoku solver and generator with a benchmark suite for comparing the fastest known solvers.
https://t-dillon.github.io/tdoku
BSD 2-Clause "Simplified" License
197 stars 25 forks source link

Build with flag -DMINISAT=on fails on mac #7

Closed afkcodes closed 2 years ago

afkcodes commented 2 years ago

Hello Tom, thanks for this amazing project I am making a small side project a sudoku game where I was trying to generate some really difficult puzzles. can you help me with a config for that I tried one you shared in an issue earlier but it requires minisat to be enabled and when I am trying to build with minisat I am greeted with the following error?

I did install minisat using brew but still, the error comes up.

A small config for creating extremely hard puzzles would be a great help.

❯ ./BUILD.sh  -DMINISAT=on
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/ashish/tdoku/build
[  4%] Building CXX object CMakeFiles/tdoku_object.dir/src/solver_dpll_triad_simd.cc.o
[  8%] Building CXX object CMakeFiles/tdoku_object.dir/src/util.cc.o
[  8%] Built target tdoku_object
[ 12%] Linking CXX static library libtdoku_static.a
[ 12%] Built target tdoku_static
[ 16%] Linking CXX shared library libtdoku_shared.dylib
[ 16%] Built target tdoku_shared
[ 20%] Building CXX object CMakeFiles/run_benchmark.dir/src/run_benchmark.cc.o
[ 24%] Building CXX object CMakeFiles/run_benchmark.dir/src/util.cc.o
[ 28%] Building CXX object CMakeFiles/run_benchmark.dir/src/solver_dpll_triad_simd.cc.o
[ 32%] Building CXX object CMakeFiles/run_benchmark.dir/other/other_solvers.cc.o
[ 36%] Building CXX object CMakeFiles/run_benchmark.dir/other/other_minisat.cc.o
/Users/ashish/tdoku/other/other_minisat.cc:1:10: fatal error: 'minisat/core/Solver.h' file not found
#include <minisat/core/Solver.h>
         ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/run_benchmark.dir/other/other_minisat.cc.o] Error 1
make[1]: *** [CMakeFiles/run_benchmark.dir/all] Error 2
make: *** [all] Error 2
❯ brew install minisat
Warning: minisat 2.2.1 is already installed and up-to-date.
To reinstall 2.2.1, run:
  brew reinstall minisat
t-dillon commented 2 years ago

Hi Ashish,

To build with brew-installed minisat on osx you can try adding these lines to CMakeLists.txt:

include_directories("/usr/local/include")
link_directories("/usr/local/lib")

To generate some hard puzzles you might run like this:

build/generate -c0 -g1 -d1 -e20 -n100 -p0 -s1

And if you also prefer to drive towards low-clue or high-clue puzzles you might change to -c1 or -c-1 respectively.

But bear in mind that this generator drives towards a notion of difficulty that doesn't always agree with human perceived difficulty (even if it's pretty well correlated). Consider using a separate rating tool to evaluate the generated puzzles if you want a rating that aligns with convention.

afkcodes commented 2 years ago

Tried adding those lines, it got built successfully now and yeah i am checking the sudoku with multiple rating tools to confirm the difficulty. you are just awesome. Thanks.

afkcodes commented 2 years ago

All things are great thanks Tom closing this, you are just awesome.

afkcodes commented 10 months ago

@t-dillon came back here, just wanted to know how can i generate pretty easy puzzles so that a 10 year kid can play it easily. Any help would be a great.

t-dillon commented 10 months ago

The closest thing tdoku has to puzzle rating is the guess count reported by its generator. If you tell it to look for puzzles that require few guesses by passing -g-1 it will converge on puzzles that require only easy techniques. That said, you'll get much better developed and human-aligned ratings from tools like Sudoku Explainer (http://forum.enjoysudoku.com/sudoku-explainer-t39865.html), so you may prefer to generate puzzles however you like and then filter them by evaluating with SE.

afkcodes commented 10 months ago

Thanks i am using Sudoku explainer already to rate but the command i was trying was giving some insane puzzles :)