Sudoku online solver

Post the puzzle or solving technique that's causing you trouble and someone will help

Sudoku online solver

Postby thebeing » Fri Oct 27, 2006 9:32 pm

After a quick tour around sudoku forums I realized the need for an online solver for the puzzles that just seem unsolvable. (Are those puzzles solvable after all ?)

So, in my sudoku site I added, a solver for your own puzzles.

Hope it's helpfull.

Site: www.thesudokuvalley.com

Solver: www.thesudokuvalley.com/sudoku/solveyourpuzzle.php
thebeing
 
Posts: 7
Joined: 24 October 2006

Strange

Postby Carcul » Fri Oct 27, 2006 11:37 pm

Hi Thebeing, and welcome to this forum.

Thebeing wrote:I realized the need for an online solver for the puzzles that just seem unsolvable. (Are those puzzles solvable after all ?)


Just pasted two puzzles in your solver, puzzle 77 and the following one,

Code: Select all
 . 5 2 | . . 6 | 8 . .
 . . . | . . 7 | . 2 .
 . . . | . . . | 6 . .   
-------+-------+------
 . . 4 | 8 . . | 9 . .
 2 . . | 4 1 . | . . .
 . . 1 | . . . | . . 8
-------+-------+------
 . . 6 | 1 . . | 3 8 .
 . . . | . 9 . | . . 6
 3 . . | 6 . . | 1 . 9

and this is what your solver reports for both:

"The Sudoku given is wrong. For your convenience, you shoyld enter in the Sudoku matrix, only the numbers you are sure about, or only those given initially by the puzzle. Another reason for not getting answer is that the Sudoku given has more tha none solutions and therefore not a valid one."

Am I missing something?

Carcul
Carcul
 
Posts: 724
Joined: 04 November 2005

Postby Len » Sat Oct 28, 2006 5:32 am

Here is I think a solution which was really easy to find by trial and error. So I suspect you're right - there are probably more. Anyone have another one? Otherwise I'll look a bit further:
752/346/891
163/987/524
498/251/637
674/835/912
285/419/763
931/762/458
526/174/389
817/593/246
349/628/175
Len
 
Posts: 25
Joined: 04 August 2006

Postby udosuk » Sat Oct 28, 2006 8:28 am

Len, your solution is wrong, r9c9 should be 9 not 5...

The solution I found is this:

152946837
963587421
847231695
574863912
289415763
631729548
796152384
415398276
328674159

I think it's unique but am not 100% sure...
udosuk
 
Posts: 2698
Joined: 17 July 2005

Re: Strange

Postby udosuk » Sat Oct 28, 2006 8:33 am

Carcul wrote:... and this is what your solver reports for both:

"The Sudoku given is wrong. For your convenience, you shoyld enter in the Sudoku matrix, only the numbers you are sure about, or only those given initially by the puzzle. Another reason for not getting answer is that the Sudoku given has more tha none solutions and therefore not a valid one."

If "shoyld" and "more tha none" really came from a report from that solver than I don't think there's much credibility for anything related to that site...:(
udosuk
 
Posts: 2698
Joined: 17 July 2005

Postby thebeing » Sat Oct 28, 2006 12:26 pm

Hey, good morning, I fixed the spelling mistakes, and a small bug in the code



Udosuk, i tried to solve your puzzle with the corrected solver but, it seems to be a problem. The solver ends up in a situation where you have to make a guess in order to continue and then check if the guess is right. You can see this if you add, some numbers in the puzzle (the solver shows the answer).

Did you do the same? Did you guess and then confirm your guess? In that case, the puzzle isn't valid cause it needs more than logic, to solve it.


Waiting for your answer.
thebeing
 
Posts: 7
Joined: 24 October 2006

Postby ronk » Sat Oct 28, 2006 12:59 pm

thebeing wrote:In that case, the puzzle isn't valid cause it needs more than logic to solve it.

That is not the definition of "valid" used by almost everyone else. If the puzzle has a solution it is considered valid ... even if one guesses all the way through.

Indeed, most solvers use the "dancing links" to determine if a puzzle is valid and dancing links doesn't use any logical techniques.
ronk
2012 Supporter
 
Posts: 4764
Joined: 02 November 2005
Location: Southeastern USA

Postby RW » Sat Oct 28, 2006 1:46 pm

thebeing wrote:In that case, the puzzle isn't valid cause it needs more than logic to solve it.

I tried some easier puzzles in your solver. First one that required only a XY-wing - invalid! Then one that solved with a naked pair - invalid! Let's try one with some locked candidates - invalid! Finally one with only hidden singles, Yes! It solved it!

thebeing, I would strongly advice you to remove that solver from your site and replace it with a brute force solver that uses dancing links or some other algorithm that solves all valid puzzles. You just cannot have a program for public use that makes ridiculous claims that even the easiest puzzles, standard newspaper difficulty, are invalid! This only confuses people and causes angry phonecalls to the newspapers for publishing supposedly invalid puzzles.

Your solving guide describes three different techniques, all equal to hidden single, so let's make one more test... oh come on! Your solver cannot even find a naked single!!! Seriously, take it away, learn some techniques and write a new one!

RW
RW
2010 Supporter
 
Posts: 1010
Joined: 16 March 2006

Postby thebeing » Sat Oct 28, 2006 1:51 pm

I agree that the puzzle can be solved, but haven't you got in the position, where you try guessing for hours, in a "guess" puzzle? (that maybe hasn't a solution)

If you try solving it at home, you can find if it has or hasn't a solution (web)
but what if you are trying to solve it for example while travelling by bus.

The problem occurs when newspapers, web authors, or anyone who produces sudoku puzzles, publish puzzles that can't be solved anyway... I mean that if I knew that a sudoku has a solution even If i had to guess (still travelling by bus) that would be fine. I would just keep trying and thinking... Sadly, there are numerous unsolvable puzzles out there which have annoyed me in instances (like the one with the bus)... That's why I initially excluded guessing... But I'll work on it...
thebeing
 
Posts: 7
Joined: 24 October 2006

Postby thebeing » Sat Oct 28, 2006 2:06 pm

could you give me the puzzles you entered the solver ... so I casn work with such cases
thebeing
 
Posts: 7
Joined: 24 October 2006

Postby RW » Sat Oct 28, 2006 2:31 pm

Here's one example, from my local newspaper yesterday:
Code: Select all
..3|..7|4..
..1|5..|..7
...|21.|..9
---+---+---
34.|.6.|2..
.9.|...|.4.
..7|.2.|.63
---+---+---
5..|.32|...
2..|..4|1..
..4|1..|8..

Solved easily on paper without guessing, without pencilmarks, in about 8 minutes - far from unsolvable by any definition. It needs locked candidates and one naked pair. I would recommend that you study the general sources for solving techniques listed at the top of Mike Barker's post here and you will learn that there are techniques that are completely logical and manageable by human solvers other than the hidden single. I can also recommend you to get hold of a sudoku program like Simple Sudoku that can be of great help in the learning process.

If you don't wish to remove your solver,you must at least change the text from saying that the puzzle isn't valid to something like "the puzzle cannot be solved with the techniques used by this solver".

Have fun learning, there's a lot of nice stuff you will discover if you follow my advice!:)

If you like to solve on the bus, you might also want to read my article on solving without pencilmarks, here.

RW
RW
2010 Supporter
 
Posts: 1010
Joined: 16 March 2006

Postby thebeing » Sat Oct 28, 2006 2:36 pm

removed it already!


But it'll be up once it is perfect! Thanks!
thebeing
 
Posts: 7
Joined: 24 October 2006

Postby Len » Sun Oct 29, 2006 1:43 am

Thanks udosuk. I tested a sequence of pairs and came up with the same solution. To check for multiple solutions I reversed the sequence and came up with the same solution. It seems this should work as long as the solution is determined by a sequence of pairs less than the total number of pairs. By the way, if every pair is required for a solution, I'd say you could be sure the solution is unique, but I don't recall seeing any puzzle like that.
Len
 
Posts: 25
Joined: 04 August 2006

Postby thebeing » Mon Oct 30, 2006 1:31 pm

Hey,

I think the solver is quite good now, after some changes I made.
I give again the url:

http://www.thesudokuvalley.com/sudoku/solveyourpuzzle.php

I tested him with some puzzles that are supposed to be difficult and it solved them...
thebeing
 
Posts: 7
Joined: 24 October 2006

Postby RW » Mon Oct 30, 2006 2:05 pm

I tried this from ravels list of The hardest Sudokus:

Code: Select all
4: Ocean #11/18 (9.4)
 +-------+-------+-------+
 | . . 1 | . . . | . . 2 |
 | . 3 . | . 4 . | . . . |
 | 5 . . | 6 . . | 3 . . |
 +-------+-------+-------+
 | . . 4 | . . 7 | . . 1 |
 | . . . | . 8 . | . 3 . |
 | 9 . . | 2 . . | 6 . . |
 +-------+-------+-------+
 | . . . | . . 8 | . . 9 |
 | . 7 . | . 2 . | . 4 . |
 | 2 . . | 1 . . | 8 . . |
 +-------+-------+-------+

Now it seems like it is actually is trying to solve it, but after a few minutes I got the following message:

Fatal error: Maximum execution time of 60 seconds exceeded in /home/.kerowyn/subkosmas/thesudokuvalley.com/sudoku/checkingforuniquesituations.php on line 68


Same thing happened when I entered a puzzle with multiple solutions. Then I tried a slightly easier puzzle that required a turbot fish (above newspaper difficulty) and it did solve it. I suppose you now have there an algorithm that can solve all puzzles, but it's just a bit slow. Not to worry, the example from ravels list is very exceptional and I don't think it's very likely that many people will enter puzzles like that. But if you wish to speed it up, there's plenty of fast algorithms to study on the programmers forum, for example the solver in dukuso's generator.

I also tried this puzzle:
Code: Select all
9..1.....
37..59...
42.6.89..
7......21
..6...4..
58......6
..18.2.97
...59...4
.....4..2

That doesn't have a solution (no place for 1 in box 1) and got a "The page cannot be displayed" message.

Still it is a big improvement from your last version, doesn't lie about the puzzles anymore. Some minor fixes and it'll be a good solver.

RW
RW
2010 Supporter
 
Posts: 1010
Joined: 16 March 2006


Return to Help with puzzles and solving techniques