January 2008
Intermediate to advanced
384 pages
8h 1m
English
This method is due to Richard Romley. The idea is to UNION a SudokuGrid with the given digits to a constrained grid that has all the constraints imposed on each cell. The code gets a bit long, but it is repetitive and can be easily generated with a text editor. I will simply show the skeleton to save space.
But Richard also demonstrated another technique that makes many newbie SQL programmers nervous—long parameter lists.
CREATE PROCEDURE SolveSudoku (IN r1c1 INTEGER, IN r1c2 INTEGER, IN r1c3 INTEGER, IN r1c4 INTEGER, IN r1c5 INTEGER, IN r1c6 INTEGER, IN r1c7 INTEGER, IN r1c8 INTEGER, IN r1c9 INTEGER, .. IN r9c1 INTEGER, IN r9c2 INTEGER, IN r9c3 INTEGER, IN r9c4 INTEGER, IN r9c5 INTEGER, IN r9c6 INTEGER, IN r9c7 ...
Read now
Unlock full access