Sudoku

Eric Parry joan4eric at gmail.com
Thu Mar 28 18:11:14 EDT 2013


On Thursday, March 28, 2013 3:06:02 PM UTC+10:30, Dave Angel wrote:
> On 03/27/2013 11:00 PM, Eric Parry wrote:
> 
> > On Wednesday, March 27, 2013 6:28:01 PM UTC+10:30, Ulrich Eckhardt wrote:
> 
> >>
> 
>       <SNIP the double-spaced garbage that GoogleGroups put in - see 
> 
> http://wiki.python.org/moin/GoogleGroupsPython >
> 
> >
> 
> > Thank you for your explanation.
> 
> > I noticed that in this particular puzzle when it ran out of candidates in a particular cycle, it then changed the last entry to the next one in line in the previous cycle. But I cannot find any code to do this.
> 
> > I was hoping to understand the logic so that I could re-write it in VBA for excel which would enable any puzzle to be entered directly.
> 
> > Your comments are a big help especially the double negative aspect.
> 
> >
> 
> 
> 
> Are you familiar with recursion?  Notice the last line in the function 
> 
> r() calls the function r() inside a for loop.
> 
> 
> 
> So when r() returns, you're back inside the next level up of the 
> 
> function, and doing a "backtrack."
> 
> 
> 
> When the function succeeds, it will be many levels of recursion deep. 
> 
> For example, if the original pattern had 30 nonzero items in it, or 51 
> 
> zeroes, you'll be 51 levels of recursion when you discover a solution.
> 
> 
> 
> If you don't already understand recursion at all, then say so, and one 
> 
> or more of us will try to explain it in more depth.
> 
> 
> 
> -- 
> 
> DaveA

Thank you for that explanation.
No, I do not understand recursion. It is missing from my Python manual. I would be pleased to receive further explanation from anyone.
Eric.



More information about the Python-list mailing list