[QUIZ] Perl 'Hard' Quiz of the Whatever #2008-03-28 - Solving Kakuro
Shlomi Fish <shlomif-ik1l9ssToec+JF/[email protected]> Fri, 28 Mar 2008 00:38:08 +0200
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Message-ID | <[email protected]> |
IMPORTANT: Please do not post solutions, hints, or other spoilers until at least 60 hours after the date of this message. Thanks. Kakuro (a.k.a Cross-sums) is a kind of puzzle game: http://en.wikipedia.org/wiki/Kakuro In it, one fills in squares in a crossword-like grid that sum to their sums. One can fill in the digits from 1 to 9, and no digit can be repeated twice. Your object is that given a Kakuro board in a text format described below, then output the final solution. You can find some sample layouts from kakuro.com here: http://www.shlomifish.org/Files/files/text/kakuro.com-layouts/ and there's a new daily puzzle everyday there. (Requires Flash) There are also some more layouts googleable or on the wikipedia page. The layout has the following format: 1. It consists of $Height lines. 2. Each line has $Width squares. Whitespace inside each line is ignored. 3. Each square starts with [ and ends with ]. 4. A square that contains a \ is a blocked square (i.e: a square that cannot have any digit). If a number appears to the left of the \ it is the sum of the digits below the square. If a number appears to the right of the \ it is the sum of the digits to the right of the square. 5. A square that contains a single digit is filled with this digit. Such digits may be used in the solutions or for hints. ------------------- The examples on http://www.shlomifish.org/Files/files/text/kakuro.com-layouts/ should be the most illustrative. The output should be the same with all the non-blocked square containing digits. Bonus points for: 1. Intermediate solutions. 2. Reasonings. Good luck! Shlomi Fish --------------------------------------------------------------------- Shlomi Fish shlomif-ik1l9ssToec+JF/[email protected] Homepage: http://www.shlomifish.org/ I'm not an actor - I just play one on T.V.