| |||||||||||
| |||||||||||
Sudoku helper or sudoku cheat
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 H112 - PHP - Further Web Page and Network HandlingA211 - Web Application Design and Deployment G906 - Well House Consultants - Programming Standards
Some other Articles
Spring turns to SummerChicken soup without the religion Use standard Perl modules Where do Perl modules load from Sudoku helper or sudoku cheat Context in Perl Ballooning from Bath Wimbledon Neck Improved mining techniques! Is photoajustment an addiction? 1770 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 at 50 posts per pageThis is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price. Link to Ezine home page (for reading). Link to Blogging home page (to add comments). |
| ||||||||||
PH: 0800 043 8225 or 01225 708225 • FAX: 0845 8382 405 or 01225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||