Re: Sudoku puzzle

*To*: mathgroup at smc.vnet.net*Subject*: [mg58428] Re: Sudoku puzzle*From*: "Jon McLoone" <jonm at wolfram.co.uk>*Date*: Sat, 2 Jul 2005 04:06:29 -0400 (EDT)*References*: <d9r4vd$560$1@smc.vnet.net><da0fn3$j2a$1@smc.vnet.net> <da2n10$94l$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Paul Abbott wrote: > In article <da0fn3$j2a$1 at smc.vnet.net>, > "Jon McLoone" <jonm at wolfram.co.uk> wrote: > > > A short solution, which I placed on Mathsource last week, applies two > > basic rules before resorting to backtracking. The rules are sufficient > > to find the 1 at {5,5} in this example. > > > > http://library.wolfram.com/infocenter/MathSource/5690/ > > Very nice. One thing that would make it more visual is to have an option > to show progress towards the solution (as was done in the TMJ article). > Showing the solution a step at a time would be particularly useful if > you are solving the puzzle by hand, get stuck, and want a hint. I agree. I added the ShowSteps option as something of an afterthought. By that point I had already made a logical mistake. The rules I had implemented consider each row, column and subgrid in isolation. I hadn't read any literature on Sudoku and this was the way that I thought I had solved a problem by hand. As such the row function did not need to know which row it was being applied to, I just used Map to apply it to all of them. Only the backtracking code knows where it is working and can report useful progress data. At some point I will go back and change this and implement the other logic referred to in the notebook. > Since there are many people out there solving Sudoku puzzles, perhaps a > webMathematica page using your solver would be a nice hook for > webMathematica and Mathematica? I dropped a very rough webMathematica version of it on http://members.wolfram.com/webMathematica/Users/jonm/sudoku.jsp (No error checking and not very pretty). Perhaps if/when I have improved the solver, I will clean this up.