Re: [SPOILER] Perl 'Easy' Quiz of the Week #2005-03-04 - attempt 2 w/ o attachments
Roger Burton West <roger-UvLOT2mcgw/[email protected]> Tue, 15 Mar 2005 12:40:29 +0000
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Mar 14, 2005 at 03:38:23PM -0000, Gillman John (Mr JG) wrote: >Once read in, the grid is checked for validity, i.e. no duplicate numbers in >a row, column or 3x3 block. Then before we actually start looking for a >solution we do a bit of pre-processing to fill out the empty cells HoL above >and to also construct a new one. First the new one; this is a HoL keyed by >row, column or block identifier (group of nine) with the value being a list >of possible digits that could be assigned to any empty cell in that group of >nine. Once we have that information we can construct the list of possible >digits for each empty cell by finding the intersection of the lists for the >row, column and 3x3 block for this cell. Interesting - it looks as though you're using my logical move 1 plus guesswork. I am told that the "proper" sudoku puzzle does not require guesswork at all, but I don't have a sufficient set of logical moves to solve every case... On the other hand your system seems to work faster than mine. >The script was actually developed on a >150MHz SPARC 10 which ain't so quick. I wasn't very good a permutations and >combinations at school but are there any mathematicians out there who can >come up with the number of possible Sudoku grids? It's certainly less than 5e70 (which I believe to be the number of ways of arranging the numbers, ignoring the other constraints: 81!/(9!)^9) Roger