[QUIZ] Perl 'Easy' Quiz of the Week #2005-03-04
Roger Burton West <roger-UvLOT2mcgw/[email protected]> Fri, 4 Mar 2005 13:42:29 +0000
| 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.
Since nobody has posted a quiz for a while, here's mine. For a change
from word puzzles, here's a number puzzle...
Sudoku (or Su Doku) is a Japanese puzzle game. The field is a 9x9 grid,
which is subdivided into nine 3x3 blocks. Each grid square must contain
a number in the range 1-9; each number must occur exactly once within
each 3x3 block, within each (full) column, and within each (full) row.
A few numbers (24 or 28, in the examples I've come across) are given as
hints, in a pattern that exhibits some rotational symmetry (like many
crosswords).
More details and an example can be found at
http://www.puzzle.jp/letsplay/sudokurule-e.html (or by googling for
"sudoku"). For convenience I'll copy their example here:
+==+==+==++==+==+==++==+==+==+
| | |6 || | | || | |1 |
+--+--+--++--+--+--++--+--+--+
| |7 | || |6 | || |5 | |
+--+--+--++--+--+--++--+--+--+
|8 | | ||1 | |3 ||2 | | |
+==+==+==++==+==+==++==+==+==+
| | |5 || |4 | ||8 | | |
+--+--+--++--+--+--++--+--+--+
| |4 | ||7 | |2 || |9 | |
+--+--+--++--+--+--++--+--+--+
| | |8 || |1 | ||7 | | |
+==+==+==++==+==+==++==+==+==+
| | |1 ||2 | |5 || | |3 |
+--+--+--++--+--+--++--+--+--+
| |6 | || |7 | || |8 | |
+--+--+--++--+--+--++--+--+--+
|2 | | || | | ||4 | | |
+==+==+==++==+==+==++==+==+==+
Your objectives:
(1) Write a program to check the correctness of a solution.
(2) Write a solver. (There are several of these on-line already.)
(3) Write a random puzzle generator.
At the time of posting I have done (1) and (2) in Perl...
Roger