IMPORTANT: Please do not post solutions, hints, or other spoilers until at least 60 hours after the date of this message. Thanks. IMPORTANTE: Por favor, no enviéis soluciones, pistas, o cualquier otra cosa que pueda echar a perder la resolución del problema hasta que hayan pasado por lo menos 60 horas desde el envío de este mensaje. Gracias. IMPORTANT: S'il vous plaît, attendez au minimum 60 heures après la date de ce message avant de poster solutions, indices ou autres révélations. Merci. WICHTIG: Bitte schicken Sie keine Lösungen, Tipps oder Hinweise für diese Aufgabe vor Ablauf von 60 Stunden nach dem Datum dieser Mail. Danke. Qing3 Zhu4Yi4: Qing3 Ning2 Deng3Dao4 Jie1Dao4 Ben3 Xin4Xi2 Zhi1Hou4 60 Xiao3Shi2, Zai4 Fa1Biao3 Jie3Da2, Ti2Shi4, Huo4 Qi2Ta1 Hui4 Xie4Lou4 Da2An4 De5 Jian4Yi4. Xie4Xie4. ---------------------------------------------------------------- You will write a function to lay out crossword puzzles. If you are unfamiliar with American and British style crossword puzzles, an example is at: http://perl.plover.com/qotw/misc/r005/puzzle.jpg Your function, 'layout_crossword' will get an array argument which represents the desired layout of the crossword puzzle. it will then return a display version of the puzzle. For example, the diagram at the URL above would be represented like this: @sample_puzzle = qw( ....X.....X.... ....X.....X.... ....X.....X.... .......X....... XXX......X..... .....X......XXX ......X...X.... ...X.......X... ....X...X...... XXX......X..... .....X......XXX .......X....... ....X.....X.... ....X.....X.... ....X.....X.... ); If given this array as argument, layout_crossword(@sample_puzzle) would return an array containing the following 61 strings: ############################################################################ #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 #37 #38 # # # # # # # ###### # # ###### # # # # # # # # # # ###### # # ###### # # # # ############################################################################ #39 # # ######40 # #41 # # # #42 ######43 # # # # # # ###### # # # # # # ###### # # # # # # ###### # # # # # # ###### # # # ############################################################################ #44 # # #45 ######46 # # ######47 # #48 # # # # # # # # ###### # # ###### # # # # # # # # # # ###### # # ###### # # # # # # ############################################################################ ################49 #50 # # # #51 ######52 # # # # # ################ # # # # # ###### # # # # # ################ # # # # # ###### # # # # # ############################################################################ #53 #54 #55 # # ######56 # # #57 # # ################ # # # # # ###### # # # # # ################ # # # # # ###### # # # # # ################ ############################################################################ #58 # # # # #59 # ######60 # # # #61 #62 #63 # # # # # # # # ###### # # # # # # # # # # # # # # ###### # # # # # # # ############################################################################ #64 # # # ######65 # #66 # # ######67 # # # # # # # # ###### # # # # ###### # # # # # # # # ###### # # # # ###### # # # # ############################################################################ #68 # # # ######69 # # # # ######70 # # # # # # # # ###### # # # # ###### # # # # # # # # ###### # # # # ###### # # # # ############################################################################ #71 # # # ######72 # # # # ######73 # # # # # # # # ###### # # # # ###### # # # # # # # # ###### # # # # ###### # # # # ############################################################################ (There are 61 lines here, each 76 characters long; the function should return a list of 61 strings, one for each line, with each string 76 characters long.) layout_puzzle() will make use of two auxiliary arrays that describe what empty and full squares should look like. In the example above, these arrays were: my @empty_square = qw(###### #....# #....# #....# ###### ); my @full_square = qw(###### ###### ###### ###### ###### ); layout_puzzle() must scan over the input representation, constructing an array of strings, which it will return. It must repeatedly insert the contents of @empty_square or @full_square into the appropriate place in the output array, depending on whether the corresponding character of the input was '.' (an empty square) or any other character (a full square.) layout_puzzle() must also compute the appropriate numerals to insert into the blank squares, and insert them into the right places in the output. A numeral should be placed into the upperleftmost empty part of its square. If the numeral doesn't fit in the square, the program should die. Again, empty parts of a square are denoted by '.' characters. An empty square should receive a numeral if it is the first square in a word; words run from right to left and from top to bottom. See the diagram for an example. All '.' characters should be translated to real spaces on output, as in the example. The function should RETURN A LIST OF STRINGS, which might be printed later. It should not print anything.