embg / Gorokhovsky_CSCI2270_FinalProject

A SAT-based Sudoku solver.
GNU General Public License v3.0
0 stars 1 forks source link

Segmentation fault #2

Open sbarili opened 8 years ago

sbarili commented 8 years ago

//first of all, sorry I added a new issues.md file to your project repo, I misunderstood directions. I closed the pull requests for it //the program downloads correctly and it runs one line with two ++ symbols then it seg faults

embg commented 8 years ago

Did you run it on a file? It needs an input file.

sbarili commented 8 years ago

I ran it exactly the way you expressed on github

On Sun, May 1, 2016 at 6:23 PM, RaphaelHythloday notifications@github.com wrote:

Did you run it on a file?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/RaphaelHythloday/Gorokhovsky_CSCI2270_FinalProject/issues/2#issuecomment-216083928

embg commented 8 years ago

So you ran ./satdoku puzzle, where puzzle is a valid input file? If so, please post the contents of the file you ran it on so I can debug. Thanks.

sbarili commented 8 years ago

I believe I did. I cloned the repo onto my machine (linux dist.) and ran in from the command line with that command and it set faulted. I'll go ahead and upload that.

On Tue, May 3, 2016 at 7:46 PM, RaphaelHythloday notifications@github.com wrote:

So you ran ./satdoku puzzle, where puzzle is a valid input file? If so, please post the contents of the file you ran it on so I can debug. Thanks.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/RaphaelHythloday/Gorokhovsky_CSCI2270_FinalProject/issues/2#issuecomment-216718489

sbarili commented 8 years ago

Bear with me, I'm new to this stuff. I took a screenshot of the error I'm getting: screenshot 2016-05-04 13 41 37

embg commented 8 years ago

Ya. So your problem is you don't have any puzzle file in your directory (according to ls), which causes the segfault. If we were using a more sophisticated language we would get an exception telling us what went wrong, but because C++ is stupid we just get a segfault. Anyway, the point is all you have to do is make a puzzle file with a valid input. You can do that, for example, by running this:

echo "9 3
..3.2.6..9..3.5..1..1,8.6,4....8,1.2,9..7.......8..6,7.8,2....2,6.9,5..8..2.3..9..5.1.3.." > puzzle

That just takes the first example from the readme and puts it in a file called puzzle. If you then run ./satdoku puzzle you should get

Puzzle:
+-----+-----+-----+
|    3|  2  |6    |
|9    |3   5|    1|
|    1|8   6|4    |
+-----+-----+-----+
|    8|1   2|9    |
|7    |     |    8|
|    6|7   8|2    |
+-----+-----+-----+
|    2|6   9|5    |
|8    |2   3|    9|
|    5|  1  |3    |
+-----+-----+-----+
Solution:
+-----+-----+-----+
|4 8 3|9 2 1|6 5 7|
|9 6 7|3 4 5|8 2 1|
|2 5 1|8 7 6|4 9 3|
+-----+-----+-----+
|5 4 8|1 3 2|9 7 6|
|7 2 9|5 6 4|1 3 8|
|1 3 6|7 9 8|2 4 5|
+-----+-----+-----+
|3 7 2|6 8 9|5 1 4|
|8 1 4|2 5 3|7 6 9|
|6 9 5|4 1 7|3 8 2|
+-----+-----+-----+

Please let me know if this works for you.

P.S. Make sure minisat is installed on your system (sudo apt-get install minisat). You can uninstall it with sudo apt-get purge minisat just FYI.

embg commented 8 years ago

Also, I just added an example puzzle file to the repo, if you re-clone you should be good.