------art_25939_29502231.1185723622927
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,


Here's my solution: http://pastie.caboo.se/83230

I've been inspired by Eric I.'s solution to the Verbal Arithmetic Ruby Quiz
(http://rubyquiz.com/quiz128.html): divide the problem into steps, solve
each step in turn, backtrack if you're stuck. Things are a lot simpler
though for this case than for the Verbal Arithmetic case, since there are
less different types of step to consider for the Crossword case.


Some examples using /usr/share/dict/words as dictionary (1.cw, 2.cw
and 3.cwcontain the 3 given crossword definitions):

$ ./rq132_crosswordsolver_rafc.rb 1.cw
INNER
N#O#E
CRUMB
A#N#E
SISAL
(Solution found in 0.042307 seconds.)

$ ./rq132_crosswordsolver_rafc.rb 2.cw
##D####M
CLOSES#A
##U##T#T
RUBYQUIZ
U#L##C##
B#ERECTS
Y####O##
(Solution found in 0.029773 seconds.)

$ ./rq132_crosswordsolver_rafc.rb 3.cw
CLUE#OLIGOCENE#ODER
A#N#S#I#L#H#A#O#I#E
PARAMECIA#ENVISAGED
E#U#U#K#DIN#I#L#E#S
#SLOG#E#I#I#E#OHSA#
W#I###DOODLES###T#C
HYENAS##L#L##RETINA
O#S##E#SINEW#E##O#T
OUTREACH#A#INSIGNIA
S##E#L#ATOLL#O#I##L
HEADBAND#M#MALAGASY
I#M##N#ERICA#V##N#Z
NOUGAT##O#A##EXCITE
G#S###ESTELLA###M#S
#WINE#N#T#L#G#WAIF#
I#N#L#K#ELI#A#I#S#V
DIGESTION#POSTNATAL
E#L#A#D#E#E#S#E#I#A
SAYS#GUARDRAIL#SCAD
(Solution found in 0.575114 seconds.)

For this last case, the runtime is usually under a second, but I must admit
that it can wildly fluctuate and sometimes takes minutes to find a solution.


Regards,
Raf

------art_25939_29502231.1185723622927--