ANN: Sudoku Assistant

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

ANN: Sudoku Assistant

Alex Tweedly

The other day I mentioned that I had done a simple "Sudoku Assistant" -
a simple stack which gives you some assistance in solving Sudoku
Puzzles. I had done it over the course of an evening or two while on
vacation, and had decided that I really didn't find Sudoku puzzles all
that fascinating, so it had been languishing since then.

But mentioning it here, and having a couple of people ask about it,
revived my interest, so I've spent 3 hours today tidying it up and
adding a couple of useful features (Undo/Redo/combination counts/...).
(I also spent 4 or 5 hours learning basics of RunRev in some areas I
hadn't used before - useful for me, but only contributed about 10
minutes of useful work towards this stack :-)

It's posted in RevOnline, under Games, or username alextweedly - called
SudokuAssistant
Enjoy, and as always I'd welcome any comments, suggestions, even
requests ...

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Dan Shafer
Oh, thanks a LOT, Alex! Now I'll waste the entire freaking weekend  
doing Sudoku. I am already hooked! I never saw this kind of puzzle  
before (and after reading the article in Wikipedia, I know why;  
they're pretty new in terms of wide popularity) but it so fits my  
obsession with numeric patterns that I'm afraid I may just have found  
the thing that will ultimately destroy all that remains of my  
productivity.

I noticed a couple of things as I began working with your program.

First, I noticed that when I choose one of the puzzles with some  
givens in it, those givens are not eliminated from the display list  
of possibilities for other squares in the region. As I understand the  
rules of Sudoku -- and my knowledge base is less than two hours old  
at this point -- that would be quite helpful and would be expected, no?

Second, when I loaded puzzle #1, at some point in solving it, the  
square I'll call square 7 (lower left) in the lower-right region  
suddenly became blank and responded to clicks only by highlighting.  
It was no longer possible to put a value into that cell. That cell  
was NOT a given when the puzzle started.

Third, when played in the IDE, your program brings up the message box  
all the time, which is just slightly annoying. I'm guessing that if I  
compile it into a standalone that problem would go away.

Fourth -- and perhaps related to my second point above -- the number  
of solution values in the right column dropped to 0 at some point and  
stayed there. I took that to mean I had an error somewhere in the  
partial solution but after careful inspection, it seemed OK. But my  
scan may have overlooked the problem cited as the second point above,  
so that may be moot and expected behavior.

It occurred to me it would be way cool if I could take a puzzle from  
a magazine, enter the givens in your assistant and save it. I know  
you have a mechanism for loading a text file with a known format that  
would also accomplish that but unless you have plans to implement  
that, I may take a crack at it.

Cool program. Now where did I put my No-Doz?

:-D

Dan

On Jul 29, 2005, at 5:20 PM, Alex Tweedly wrote:

>
> The other day I mentioned that I had done a simple "Sudoku  
> Assistant" - a simple stack which gives you some assistance in  
> solving Sudoku Puzzles. I had done it over the course of an evening  
> or two while on vacation, and had decided that I really didn't find  
> Sudoku puzzles all that fascinating, so it had been languishing  
> since then.
>
> But mentioning it here, and having a couple of people ask about it,  
> revived my interest, so I've spent 3 hours today tidying it up and  
> adding a couple of useful features (Undo/Redo/combination  
> counts/...). (I also spent 4 or 5 hours learning basics of RunRev  
> in some areas I hadn't used before - useful for me, but only  
> contributed about 10 minutes of useful work towards this stack :-)
>
> It's posted in RevOnline, under Games, or username alextweedly -  
> called SudokuAssistant
> Enjoy, and as always I'd welcome any comments, suggestions, even  
> requests ...
>
> --
> Alex Tweedly       http://www.tweedly.net
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date:  
> 27/07/2005
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Alex Tweedly
Dan Shafer wrote:

> Oh, thanks a LOT, Alex! Now I'll waste the entire freaking weekend  
> doing Sudoku. I am already hooked! I never saw this kind of puzzle  
> before (and after reading the article in Wikipedia, I know why;  
> they're pretty new in terms of wide popularity) but it so fits my  
> obsession with numeric patterns that I'm afraid I may just have found  
> the thing that will ultimately destroy all that remains of my  
> productivity.

I only discovered them in May - they were mentioned on slashdot, and a
couple of days later I went on vacation - and found myself with laptop
but without Internet connectivity. In the airport on the way, I bought a
newspaper, which had a couple of puzzles in it.  The program was the
result ....  but I found the idea of writing a program to do it more
appealing than doing the puzzles myself.

> I noticed a couple of things as I began working with your program.
>
> First, I noticed that when I choose one of the puzzles with some  
> givens in it, those givens are not eliminated from the display list  
> of possibilities for other squares in the region. As I understand the  
> rules of Sudoku -- and my knowledge base is less than two hours old  
> at this point -- that would be quite helpful and would be expected, no?

Yes, it would be *too* helpful. In fact, if I did that immediately, you
would only see completed puzzles for number 1,2 and 3. Number 4 is a lot
harder than the others - they can be "solved" simply by diligently
applying the rule of eliminating row,col,square for those squares which
have only a single value left. Puzzle 4 requires a big step up to
eliminating values due to common pairs. (I'll say no more in case that
would be a "spoiler" for anyone).

So you get to do a little bit of work - you can click on a square
containing a single value, and it will eliminate that value from the
rest of its in the row, column and 3x3 square.  Or, if you're impatient,
you can click on the "Auto" button and it will do that for you, to each
button in turn.

> Second, when I loaded puzzle #1, at some point in solving it, the  
> square I'll call square 7 (lower left) in the lower-right region  
> suddenly became blank and responded to clicks only by highlighting.  
> It was no longer possible to put a value into that cell. That cell  
> was NOT a given when the puzzle started.

I've seen that once, but not been able to reproduce it. I am 80% sure it
was a follow-on from filling-in a wrong answer (which causes a "?" to
appear somewhere), and then Undo-ing my way back past that point. I made
a couple of fixes since I saw it, nothing that I could tie in to that
symptom - but natural optimism made me hope I had fixed it as a
side-effect.

I'll try again to make it happen (and code-review the Undo after error
cases).

>
> Third, when played in the IDE, your program brings up the message box  
> all the time, which is just slightly annoying. I'm guessing that if I  
> compile it into a standalone that problem would go away.

Hmmm - I must have left in a debug statement somewhere. My fault - I
usually use a "log" function, but originally this was going to be
"throw-away" code that I wrote for amusement during my vacation, and
didn't intend to do anything more with. I'll look for that too ...

> Fourth -- and perhaps related to my second point above -- the number  
> of solution values in the right column dropped to 0 at some point and  
> stayed there. I took that to mean I had an error somewhere in the  
> partial solution but after careful inspection, it seemed OK. But my  
> scan may have overlooked the problem cited as the second point above,  
> so that may be moot and expected behavior.

Yes, it does mean that there is a wrong answer. You didn't by any chance
read the "Help" info ?  :-)
The last sentence says:

> Also, the number of remaining possible combinations shown on the right
> will be 0, so it will be fairly obvious. You can then Undo and try
> another value, or try a different square.

When you put in an incorrect value for a square, it will eliminate that
number from rest of the the row, col and 3x3 square. If this results in
there being no possible values remaining, that square gets a "?" - and
the number of possible combinations goes to 0.  So if you notice it's at
0, Undo until you get back above the highest "0" line, then Redo once
and check the row,col and square corresponding to that last change for
any "?"s. Note this does NOT mean that your last entered value is wrong;
it could in fact be that this one is correct and there was an earlier
wrong value, which means that this correct step eliminates the last
possible value from some square.


> It occurred to me it would be way cool if I could take a puzzle from  
> a magazine, enter the givens in your assistant and save it. I know  
> you have a mechanism for loading a text file with a known format that  
> would also accomplish that but unless you have plans to implement  
> that, I may take a crack at it.
>
That would be very easy - I'll do that at the same time as I fix the
spelling mistakes in the Help info and re-upload to RevOnline in an hour
or so ....


--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Alex Tweedly
Alex Tweedly wrote:

>
>> It occurred to me it would be way cool if I could take a puzzle from  
>> a magazine, enter the givens in your assistant and save it. I know  
>> you have a mechanism for loading a text file with a known format
>> that  would also accomplish that but unless you have plans to
>> implement  that, I may take a crack at it.
>>
> That would be very easy - I'll do that at the same time as I fix the
> spelling mistakes in the Help info and re-upload to RevOnline in an
> hour or so ....
>
OK, done.
Beware that it does NOT make any sanity check on the puzzle as you save
it - so if you have specified some values that do not permit any
possible completion - it gets saved. Even if you have already got to a
blocking point (with "?s showing), it gets saved.
The file format is the same as used for loading - so every square is
either a known, fixed, single digit - or is shown as "x". So if you are
working through a puzzle, and have reduced the number of possible values
in other squares - possibly down to a single remaining value - they are
nevertheless all shown as "x". It is only those squares that you have
defined that get their digit in the file.

btw - it's still faster to edit the file by hand :-)  
Depends on whether your a "command line, text editor" user or a GUI guy :-)

Also fixed some typos in Help, removed the annoying "put ... msg", and
added version number (1.1)
Didn't manage reproduce the "square goes blank" problem yet.

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Dan Shafer
Alex.....

Thanks for the fast update. I'll go play with the new version.

MEanwhile, I've discovered the Sudoku of the Day, an excellent Mac  
shareware program that generates new puzzles and saves, and a  
Dashboard Widget that plays quite nicely as well.

I have not yet solved my first puzzle completely but I'm determined  
to do so today.

These things are addictive!

Dan

On Jul 30, 2005, at 2:20 PM, Alex Tweedly wrote:

> Alex Tweedly wrote:
>
>
>>
>>
>>> It occurred to me it would be way cool if I could take a puzzle  
>>> from  a magazine, enter the givens in your assistant and save it.  
>>> I know  you have a mechanism for loading a text file with a known  
>>> format that  would also accomplish that but unless you have plans  
>>> to implement  that, I may take a crack at it.
>>>
>>>
>> That would be very easy - I'll do that at the same time as I fix  
>> the spelling mistakes in the Help info and re-upload to RevOnline  
>> in an hour or so ....
>>
>>
> OK, done.
> Beware that it does NOT make any sanity check on the puzzle as you  
> save it - so if you have specified some values that do not permit  
> any possible completion - it gets saved. Even if you have already  
> got to a blocking point (with "?s showing), it gets saved.
> The file format is the same as used for loading - so every square  
> is either a known, fixed, single digit - or is shown as "x". So if  
> you are working through a puzzle, and have reduced the number of  
> possible values in other squares - possibly down to a single  
> remaining value - they are nevertheless all shown as "x". It is  
> only those squares that you have defined that get their digit in  
> the file.
>
> btw - it's still faster to edit the file by hand :-)   Depends on  
> whether your a "command line, text editor" user or a GUI guy :-)
>
> Also fixed some typos in Help, removed the annoying "put ... msg",  
> and added version number (1.1)
> Didn't manage reproduce the "square goes blank" problem yet.
>
> --
> Alex Tweedly       http://www.tweedly.net
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date:  
> 27/07/2005
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

jim hurley-3
In reply to this post by Alex Tweedly
>
>Message: 3
>Date: Sat, 30 Jul 2005 01:20:19 +0100
>From: Alex Tweedly <[hidden email]>
>Subject: ANN: Sudoku Assistant
>To: How to use Revolution <[hidden email]>
>Message-ID: <[hidden email]>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>
>The other day I mentioned that I had done a simple "Sudoku Assistant" -
>a simple stack which gives you some assistance in solving Sudoku
>Puzzles. I had done it over the course of an evening or two while on
>vacation, and had decided that I really didn't find Sudoku puzzles all
>that fascinating, so it had been languishing since then.
>
>But mentioning it here, and having a couple of people ask about it,
>revived my interest, so I've spent 3 hours today tidying it up and
>adding a couple of useful features (Undo/Redo/combination counts/...).
>(I also spent 4 or 5 hours learning basics of RunRev in some areas I
>hadn't used before - useful for me, but only contributed about 10
>minutes of useful work towards this stack :-)
>
>It's posted in RevOnline, under Games, or username alextweedly - called
>SudokuAssistant
>Enjoy, and as always I'd welcome any comments, suggestions, even
>requests ...
>
>--
>Alex Tweedly       http://www.tweedly.net


Alex,

Thanks for the puzzle. Lots of fun. Dell Crosswords has a full page
of these every month, though none as tough a your last. They
generally are deterministic all the way to the end. Your number four
requires assuming a solution at one point near the end and
discovering a contradiction if the guess was wrong--proof by
contradiction. (I must confess that the labels make it more difficult
for me--harder to see what is filled in and what isn't.)

I am interested in what algorithm is used under the "Auto" button.

If you also enjoy Cryptogram puzzles, I have one which retrieves 4
quotes from the web every day and encodes them for your decoding
pleasure. It is my daily diagnostic tool to reveal the onset of
senility. You can take a look at:

      go stack url "http://home.infostations.net/jhurley/DailyCryptoquote.rev"

It's a 450k file. It contains a dictionary for a decoder utility.

Jim
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Alex Tweedly
Jim Hurley wrote:

> Alex,
>
> Thanks for the puzzle. Lots of fun. Dell Crosswords has a full page of
> these every month, though none as tough a your last. They generally
> are deterministic all the way to the end. Your number four requires
> assuming a solution at one point near the end and discovering a
> contradiction if the guess was wrong--proof by contradiction.

No, it doesn't require that. There's a perfectly deterministic technique
that can solve puzzle #4 - I'll append a brief description of  it to the
end of this message - but beware it uses puzzle #4 to demonstrate it, so
don't read all the way to the end unless you want to read that ...

> (I must confess that the labels make it more difficult for me--harder
> to see what is filled in and what isn't.)
>
Sorry Jim I'm not sure I follow - do you mean you'd prefer to have blank
squares for every space that has not yet been determined (rather than
the set of possible values) ?   That would seem to me much less helpful
- but I'll try it and see how it looks.

> I am interested in what algorithm is used under the "Auto" button.
>
Code is all there for you to look at :-)
But all it does is look at each square in turn, and if it already knows
that there is only a single value possible, then it removes that value
from the rest of the square's row,col and 3x3 square.   It could repeat
that scan (very occasionally you can find a case where a square has been
already examined while multiple values were possible, and which reduces
to a single one, and is required to complete the puzzle) - but it
doesn't even do that.

> If you also enjoy Cryptogram puzzles, I have one which retrieves 4
> quotes from the web every day and encodes them for your decoding
> pleasure. It is my daily diagnostic tool to reveal the onset of
> senility. You can take a look at:
>
>      go stack url
> "http://home.infostations.net/jhurley/DailyCryptoquote.rev"
>
> It's a 450k file. It contains a dictionary for a decoder utility.

Thanks Jim. I'll take a look at that - though I'm more likely to write a
stack to solve them than I am to do it myself.

I have not yet found any "puzzle" that is more challenging or
stimulating that programming.







scroll beyond here only if you want to read solving techniques  ....








In Puzzle #4, assuming you've hit the "Auto" button (or worked through
yourself to the point where all single-valued squares have been used to
eliminate their peers), you are left with a number of possibilities.

Look at squares 8,7 and 8,9. They both contain only two possibilities 1
and 6. And they are both in the same column.
One of them must contain one of the two values, and the other must
contain the other value.

Therefore no other square in column 8 can contain either 1 or 6.

This allows us to (deterministically - no guessing) eliminate "6" from
the set of possible values for square 8,2 - leaving only a single value
of 8.   Fill that in and you're done.

There is another such "common pair" in squares 9,2 and 9,3 - which
allows you to eliminate the value 5 from 9,7  - but there are still
multiple values left.

However - this allows yet another technique.  The bottom right square
now has only two places were the 5 can go - 7,7 and 7,9; since they are
both in col 7, we know that the 5 in col 7 is in one or other of those
places - i.e. it is in the lower, right 3x3 square. Therefore, it can be
eliminated from 7,2 - leaving only 6 or 8 to go there.

That is now a common pair 7,2 and 8,2 have either 6 or 8.  So eliminate
the 8 from 6,2 leaving only 5 to go there, and you make a substantial
step forward. Although you're not yet done, it's straight forward from
then on.

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

jim hurley-3
In reply to this post by Alex Tweedly
>
>Message: 14
>Date: Sun, 31 Jul 2005 15:13:08 +0100
>From: Alex Tweedly <[hidden email]>
>Subject: Re: ANN: Sudoku Assistant
>To: How to use Revolution <[hidden email]>
>Message-ID: <[hidden email]>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Jim Hurley wrote:
>
>>  Alex,
>>
>>  Thanks for the puzzle. Lots of fun. Dell Crosswords has a full page of
>>  these every month, though none as tough a your last. They generally
>>  are deterministic all the way to the end. Your number four requires
>>  assuming a solution at one point near the end and discovering a
>>  contradiction if the guess was wrong--proof by contradiction.
>
>No, it doesn't require that. There's a perfectly deterministic technique
>that can solve puzzle #4 - I'll append a brief description of  it to the
>end of this message - but beware it uses puzzle #4 to demonstrate it, so
>don't read all the way to the end unless you want to read that ...

  I used the wrong word when I said "deterministic." What I should
have said was that puzzle 4 requires a *two* stage decision making
process. In the simpler puzzles at each step there is always one
square in which there is obviously only one possibility--a one stage
decision making process.

In the fourth puzzle I reach a point where there is no square which
would allow only one character. But if I put one character in this
square then I will run into a contraction at a later stage. But if I
put another character into the square, I will be able to obtain a
unique solution. As you say, this is still a deterministic solution,
but a two stage deterministic process. Sorry for the poor description
of what I was trying to say.

>  > (I must confess that the labels make it more difficult for me--harder
>>  to see what is filled in and what isn't.)
>>
>Sorry Jim I'm not sure I follow - do you mean you'd prefer to have blank
>squares for every space that has not yet been determined (rather than
>the set of possible values) ?   That would seem to me much less helpful
>- but I'll try it and see how it looks.


Yes. In fact I copied the puzzle to Photoshop  and erased all the
labels and printed the image. Maybe this would be a possible
preference?

>
>>  I am interested in what algorithm is used under the "Auto" button.
>  >
>Code is all there for you to look at :-)
>But all it does is look at each square in turn, and if it already knows
>that there is only a single value possible, then it removes that value
>from the rest of the square's row,col and 3x3 square.   It could repeat
>that scan (very occasionally you can find a case where a square has been
>already examined while multiple values were possible, and which reduces
>to a single one, and is required to complete the puzzle) - but it
doesn't even do that.

I'll have to look at this again. It doesn't seem to complete all one
stage decisions. For example, after completing the Auto, it is clear
that the box in the second row, fifth column must be a 1. I suspect
my problem is that I don't understand the significance of the labels.
Life is full of things I don't understand.

>
>  > If you also enjoy Cryptogram puzzles, I have one which retrieves 4
>>  quotes from the web every day and encodes them for your decoding
>>  pleasure. It is my daily diagnostic tool to reveal the onset of
>>  senility. You can take a look at:
>>
>>       go stack url
>>  "http://home.infostations.net/jhurley/DailyCryptoquote.rev"
>>
>>  It's a 450k file. It contains a dictionary for a decoder utility.
>
>Thanks Jim. I'll take a look at that - though I'm more likely to write a
>stack to solve them than I am to do it myself.
>
>I have not yet found any "puzzle" that is more challenging or
>stimulating that programming.

I think this is what keeps many of  us going.

Jim
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Alex Tweedly
Jim Hurley wrote:

>>>
>>>  Thanks for the puzzle. Lots of fun. Dell Crosswords has a full page of
>>>  these every month, though none as tough a your last. They generally
>>>  are deterministic all the way to the end. Your number four requires
>>>  assuming a solution at one point near the end and discovering a
>>>  contradiction if the guess was wrong--proof by contradiction.
>>
>>  Alex,
>>
>> No, it doesn't require that. There's a perfectly deterministic technique
>> that can solve puzzle #4 - I'll append a brief description of  it to the
>> end of this message - but beware it uses puzzle #4 to demonstrate it, so
>> don't read all the way to the end unless you want to read that ...
>
>
>  I used the wrong word when I said "deterministic." What I should have
> said was that puzzle 4 requires a *two* stage decision making process.
> In the simpler puzzles at each step there is always one square in
> which there is obviously only one possibility--a one stage decision
> making process.
>
> In the fourth puzzle I reach a point where there is no square which
> would allow only one character. But if I put one character in this
> square then I will run into a contraction at a later stage. But if I
> put another character into the square, I will be able to obtain a
> unique solution. As you say, this is still a deterministic solution,
> but a two stage deterministic process. Sorry for the poor description
> of what I was trying to say.
>
But my (perhaps hard to follow) description at the tail end of the other
email shows that you don't need to try one then the other - you can use
the knowledge from two squares to eliminate a possibility from a third
square. It's kind of a two-stage deduction - but you don't need to try
one thing and then another.

>>  > (I must confess that the labels make it more difficult for me--harder
>>
>>>  to see what is filled in and what isn't.)
>>>
>> Sorry Jim I'm not sure I follow - do you mean you'd prefer to have blank
>> squares for every space that has not yet been determined (rather than
>> the set of possible values) ?   That would seem to me much less helpful
>> - but I'll try it and see how it looks.
>
>
>
> Yes. In fact I copied the puzzle to Photoshop  and erased all the
> labels and printed the image. Maybe this would be a possible preference?
>
Rather than a preference, I made it a button "Hide uncompleted" or "Show
uncompleted" so you can toggle between the two modes while working
through a puzzle.

Now available on RevOnline (ver 1.2)

>>
>>>  I am interested in what algorithm is used under the "Auto" button.
>>
>>  >
>> Code is all there for you to look at :-)
>> But all it does is look at each square in turn, and if it already knows
>> that there is only a single value possible, then it removes that value
>> from the rest of the square's row,col and 3x3 square.   It could repeat
>> that scan (very occasionally you can find a case where a square has been
>> already examined while multiple values were possible, and which reduces
>> to a single one, and is required to complete the puzzle) - but it
>
> doesn't even do that.
>
> I'll have to look at this again. It doesn't seem to complete all one
> stage decisions. For example, after completing the Auto, it is clear
> that the box in the second row, fifth column must be a 1. I suspect my
> problem is that I don't understand the significance of the labels.
> Life is full of things I don't understand.
>
It doesn't do all "one-stage" decisions. In each square it has a list of
possible values - so for a blank puzzle, each square can still have any
of the 9 digits. When you load a puzzle, some squares are changed to
have a single digit. Clicking on such a square (or specifying a value
for another square) causes the specified digit to be removed from all
"peers" of the square (i.e. in the same row, col or 3x3). Auto simply
applies that to all squares in turn.

The fact that square 5,2 "must" be a one (because there are no other
squares in its 3x3 which still have one as a possible value) would
require deduction - and my idea for the assistant was that it can do the
"mechanical" part for you, and leave the user to do the deductions.

Anyway - that's *why* it doesn't do that particular square for you.
Would be easy enough to add a button to do that kind of simple deduction
... be my guest :-)

The scripting for this puzzle isn't great (when I wrote it I didn't
intend to give it to anyone else, so it's certainly not carefully
written as I would do for a tutorial, or a product), but it's not
terrible either. Dive in ....



--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Dan Shafer
In reply to this post by Alex Tweedly
Alex.....

Downloaded Version 1.2 but the PReferences menu option does nothing  
on my machine.

Still getting addicted here. Nifty stuff.

Dan

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Alex Tweedly
Dan Shafer wrote:

> Alex.....
>
> Downloaded Version 1.2 but the PReferences menu option does nothing  
> on my machine.
>
> Still getting addicted here. Nifty stuff.

There aren't any preferences yet.

Although Jim suggested a preference for whether to display blanks rather
than the set of possible values, I decided to make it a button rather
than a preference.

 This makes it easier to switch between the two modes - initially there
should be a button at the bottom "Hide uncompleted" - click that
(*after* you have loaded a puzzle) and you will see blank squares, and
the button should switch to saying "Show uncompleted". You should be
able to switch between them at any time. (This doesn't count as an
action for Undo/Redo - you should stay in the same mode while Undoing or
Redoing).

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Dan Shafer
Alex...

Got it.

I'm doing something wrong or misunderstanding how the assistant works  
or something.

On Puzzle #1, I got to the place where I have five uncompleted cells.  
One of them has a "?" which I think means there's an error somewhere.  
But neither it nor the cell underneath it show any potential values  
when I click on them. Then I click on an adjoining square to the one  
without a "?" and select a value. Odds go to 0, so I know I've got a  
wrong value there. I "Undo" and now I have three squares -- the two  
original and the one I just undid -- that show no values to pick from  
when I click on them. SO essentially, even though I think I could  
solve the puzzle at this point, the assistant won't let me proceed.

Bug? Something I'm not grokking?

Dan

(I'll send you the text file privately.)

On Jul 31, 2005, at 3:25 PM, Alex Tweedly wrote:

> Dan Shafer wrote:
>
>
>> Alex.....
>>
>> Downloaded Version 1.2 but the PReferences menu option does  
>> nothing  on my machine.
>>
>> Still getting addicted here. Nifty stuff.
>>
>
> There aren't any preferences yet.
>
> Although Jim suggested a preference for whether to display blanks  
> rather than the set of possible values, I decided to make it a  
> button rather than a preference.
>
> This makes it easier to switch between the two modes - initially  
> there should be a button at the bottom "Hide uncompleted" - click  
> that (*after* you have loaded a puzzle) and you will see blank  
> squares, and the button should switch to saying "Show uncompleted".  
> You should be able to switch between them at any time. (This  
> doesn't count as an action for Undo/Redo - you should stay in the  
> same mode while Undoing or Redoing).
>
> --
> Alex Tweedly       http://www.tweedly.net
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date:  
> 27/07/2005
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Alex Tweedly
Dan Shafer wrote:

> I'm doing something wrong or misunderstanding how the assistant works  
> or something.
>
> On Puzzle #1, I got to the place where I have five uncompleted cells.  
> One of them has a "?" which I think means there's an error somewhere.  
> But neither it nor the cell underneath it show any potential values  
> when I click on them. Then I click on an adjoining square to the one  
> without a "?" and select a value. Odds go to 0, so I know I've got a  
> wrong value there. I "Undo" and now I have three squares -- the two  
> original and the one I just undid -- that show no values to pick from  
> when I click on them. SO essentially, even though I think I could  
> solve the puzzle at this point, the assistant won't let me proceed.
>
> Bug? Something I'm not grokking?

One bug, one not-yet-implemented feature and maybe something you weren't
fully grokking. (And for all I know, more bugs still to come ....)

The bug I found and fixed was in undo-ing after there were squares for
which no value remained possible. Although they showed on-screen as a
"?", the "?" wasn't being saved in the Undo/Redo state, so subsequent
"Undo"s could leave blank squares.

I'm not sure how that led to the problem you described to me - so I've
also added an automatic logging facility. All actions are logged (to a
custom property), and there is a new menu item - File / Save Log File
...   which will save the log file. So if anyone encounters strange
situation, they can simply save the log file and email it to me.

The not-yet-implemented feature is that it ought to stop you assigning
values to any more squares once any square has no remaining possible
values.  I will add that - but in the mean time, keep an eye on the
number of possibilities, and if it reaches 0 then you will need to Undo
(one or more times), so you may as well do it immediately.  (I figure if
you had fully grokked things, you wouldn't have continued ....)

Ver 1.3 has been uploaded to RevOnline, with these two changes.

Ver 1.4 will come later today, with an additional feature of showing a
detailed breakdown of a single step (i.e. which squares change and why),
which will be a useful way to see what the Assistant is doing for you
(and indirectly to check that it does the right thing).  That info is
actually already gathered in the log file, but I'm looking for a
graphical way to show it.

And this is actually being much more interesting than I had expected -
so there may well be a Version 2 that eliminates some of the cruft that
has sprung up in the various  Ver 1.x's as it has grown organically.

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: ANN: Sudoku Assistant

Dan Shafer
Alex....

Cool!

I downloaded a shareware product called MacSodoku and entered your  
Puzzle #1 into it and solved it in less than five minutes. It was  
great fun and very satisfying. But I think your program could be very  
valuable as a sort of training-wheels approach to learning to think  
in patterns that solve these delightful puzzles.

I'll download your new version and give it a shot today.

Dan

On Aug 1, 2005, at 5:58 AM, Alex Tweedly wrote:

> Dan Shafer wrote:
>
>
>> I'm doing something wrong or misunderstanding how the assistant  
>> works  or something.
>>
>> On Puzzle #1, I got to the place where I have five uncompleted  
>> cells.  One of them has a "?" which I think means there's an error  
>> somewhere.  But neither it nor the cell underneath it show any  
>> potential values  when I click on them. Then I click on an  
>> adjoining square to the one  without a "?" and select a value.  
>> Odds go to 0, so I know I've got a  wrong value there. I "Undo"  
>> and now I have three squares -- the two  original and the one I  
>> just undid -- that show no values to pick from  when I click on  
>> them. SO essentially, even though I think I could  solve the  
>> puzzle at this point, the assistant won't let me proceed.
>>
>> Bug? Something I'm not grokking?
>>
>
> One bug, one not-yet-implemented feature and maybe something you  
> weren't fully grokking. (And for all I know, more bugs still to  
> come ....)
>
> The bug I found and fixed was in undo-ing after there were squares  
> for which no value remained possible. Although they showed on-
> screen as a "?", the "?" wasn't being saved in the Undo/Redo state,  
> so subsequent "Undo"s could leave blank squares.
>
> I'm not sure how that led to the problem you described to me - so  
> I've also added an automatic logging facility. All actions are  
> logged (to a custom property), and there is a new menu item -  
> File / Save Log File ...   which will save the log file. So if  
> anyone encounters strange situation, they can simply save the log  
> file and email it to me.
>
> The not-yet-implemented feature is that it ought to stop you  
> assigning values to any more squares once any square has no  
> remaining possible values.  I will add that - but in the mean time,  
> keep an eye on the number of possibilities, and if it reaches 0  
> then you will need to Undo (one or more times), so you may as well  
> do it immediately.  (I figure if you had fully grokked things, you  
> wouldn't have continued ....)
>
> Ver 1.3 has been uploaded to RevOnline, with these two changes.
>
> Ver 1.4 will come later today, with an additional feature of  
> showing a detailed breakdown of a single step (i.e. which squares  
> change and why), which will be a useful way to see what the  
> Assistant is doing for you (and indirectly to check that it does  
> the right thing).  That info is actually already gathered in the  
> log file, but I'm looking for a graphical way to show it.
>
> And this is actually being much more interesting than I had  
> expected - so there may well be a Version 2 that eliminates some of  
> the cruft that has sprung up in the various  Ver 1.x's as it has  
> grown organically.
>
> --
> Alex Tweedly       http://www.tweedly.net
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date:  
> 27/07/2005
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution