Have you seen the sudoku puzzles that are being published in the Daily Telegraph and (I think) the Los Angeles times? There's a whole group of addicts out there and
helper and forum web sites too. Lisa pointed the puzzle out to me recently (no, she's not an addict!) with the thought of providing a helper spreadsheet and wondered what I could do on algorithms.
The puzzle is easily explained. You're given a 9 x 9 grid of cells with some of them already filled in with a single digit in the range 1 to 9 and you have to complete the puzzle by adding further 1 to 9 digits such that each row, each column and each cluster of 9 cells contains each digit just once. Here's a blank board:

on which I've numbered the cells just for reference.

Here's that same game board completed. I filled in the numbers that you now see in red on the form above (
try it out if you like) and when I submitted it to my program, it completed the other cells ... in this example right through to a complete solution.
I've not personally spent a huge amount of time on this - just played with the algorithms and I think that my program will solve most (but not all) puzzles. Furthermore, it's what I describe as a "spike solution" - the code is poorly written as it grew during my research. Bits of code are duplicated (I should have used a loop or functions), documentation and comments are lacking, and it's pretty poorly inset. You can
see the code in this shocking state if you like and rightly criticise me. My defence is that it's a spike solution - a proof of context that needs re-engineering.
Two questions
Have I provided a "helper" or a "cheat"? Is a program such as this one a helper in the spirit of the game, or does it go to far and provide an unfair advantage? If that's the case, where's the limit?
Should I publish code like this? I'm quite happy with my spike solution and I don't think it opens any security holes on our site. So should I say "hey - look at this and use it if you like", should I publish it with a copyright statement, or should I be ashamed of myself for even typing code this p*sspoor in the first place?


Two more sample solutions - tests of my algorithm (I'll come back and replace one with a demo of what happens when someone submits a puzzle that can't be fully resolved).
(written 2005-06-23 06:32:48)
Associated topics are indexed under
A211 - Web Application Design and Deployment [2072] Copyright, Portability and other nontechnical web site issues - (2009-03-09)
[1798] What does an browser understand? What does an HTML document contain? - (2008-09-15)
[1547] New bathing idea for hotels from Hotelympia - (2008-02-20)
[1545] Letting new visitors know we provide training courses - (2008-02-19)
[1351] Compressing web pages sent out from server. Is it worth it? - (2007-09-14)
[1256] What country are you in? How we find out on our web site - (2007-07-03)
[1198] From Web to Web 2 - (2007-05-21)
[767] Finding the language preference of a web site visitor - (2006-06-18)
[659] Web Application Components - (2006-03-28)
[443] Server side scripting of styles to suit the browser - (2005-09-12)
[23] Skills and responsibilities - (2004-08-22)
G906 - Well House Consultants - Programming Standards [2364] Getting it right from the start - new programmers - (2009-08-17)
[2363] Alpaca Case or Camel Case - (2009-08-16)
[2322] Looking for a practical standards course - (2009-08-05)
[1852] Perl and Blackberries - (2008-10-23)
[1679] PHP - Sanitised application principles for security and useability - (2008-06-16)
[1596] Selling curry to the chinese takeaway - (2008-03-31)
[945] Code quality counts - (2006-11-26)
[343] Should I use structured or object oriented? - (2005-06-10)
[272] More to programming than just programming - (2005-04-08)
[148] Programming in isolation - (2004-12-11)
H112 - PHP - Further Web Page and Network Handling [1549] http, https and ajp - comparison and choice - (2008-02-22)
[1518] Downloading data for use in Excel (from PHP / MySQL) - (2008-01-25)
[1515] Keeping staff up to date on hotel room status - (2008-01-22)
[1505] Script to present commonly used images - PHP - (2008-01-13)
[1496] PHP / Web 2 logging - (2008-01-06)
[1495] Single login and single threaded models - Java and PHP - (2008-01-04)
[1485] Copyright and theft of images, bandwidth and members. - (2007-12-26)
[1379] Simple page password protection - PHP - (2007-10-04)
[1355] .php or .html extension? Morally Static Pages - (2007-09-17)
[1210] PHP header() function - uses and new restrictions - (2007-05-30)
[1187] Updating a page strictly every minute (PHP, Perl) - (2007-05-14)
[1183] Improving searches - from OR to AND? - (2007-05-11)
[1114] PHP Image upload script - (2007-03-21)
[1009] Passing GET parameters through Apache mod_rewrite - (2006-12-27)
[936] Global, Superglobal, Session variables - scope and persistance in PHP - (2006-11-21)
[904] Of course I'll tell you by email - (2006-10-25)
[847] Image maps for navigation - a straightforward example - (2006-08-28)
[789] Hot answers in PHP - (2006-07-02)
[732] Where is a web site visitor browsing from - (2006-05-24)
[675] Adding PHP tags to an old cgi program - (2006-04-08)
[603] PHP - setting sort order with an associative array - (2006-02-13)
[565] Using PHP to output images, XML, Style sheets, etc - (2006-01-15)
[542] Morning image, afternoon image - (2005-12-26)
[537] Daily Image Santafied - (2005-12-22)
[484] Setting the file name for a downloaded document - (2005-11-03)
[451] Accessing a page via POST from within a PHP script - (2005-09-26)
[425] Caching an XML feed - (2005-08-26)
[410] Reading a news or blog feed (RSS) in your PHP page - (2005-08-12)
[376] What brings people to my web site? - (2005-07-13)
[372] Time calculation in PHP - (2005-07-08)
[345] Spotting a denial of service attack - (2005-06-12)
[314] What language is this written in? - (2005-05-17)
[220] When to use Frames - (2005-02-19)
Some other Articles
Spring turns to SummerChicken soup without the religionUse standard Perl modulesWhere do Perl modules load fromSudoku helper or sudoku cheatContext in PerlBallooning from BathWimbledon NeckImproved mining techniques!Is photoajustment an addiction?