Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It seems to me that great efficiencies could be had by applying logical reductions to the rules first. For example, in your given problem, take all the letters for "0 letters" out first:
In this case, one rule has reduced to a perfect match. The mystery word must contain 'o','l', and 'r'. I then could subtract those letters from the remaining rules, reducing the counts accordingly. Now the word has one letter in common with 'hs'. Now I can search for /^[rolh]{5}$/ and /^[rols]{5}$/, finding 'rolls' and 'solos'. (Update: Of course 'solos' must be eliminated, leaving 'rolls' as the only solution.) I believe this method could be generalized to a solution-space searching recursive algorithm. I will try to write it up when I have time. In reply to Re: Challenge: Mystery Word Puzzle
by tall_man
|
|