On Mon, Feb 19, 2001 at 03:53:18PM +0100, Jerome Quelin wrote: > The output of diff on your fixed program: > 60c60 > < $word =~ s/[^$guess]/./g; > --- > > $word =~ s/[^$guess]/[^$guess]/g; > Thank you very much for the patch! Very foolish of me not to notice that problem. > Rich Morin wrote: > > Fun to play, too, though I found that I had no chance of winning > > against it unless _I_ cheated, as well! > > Well, it's not true. The program is quite stupid. If you > guess letters in always the same order, and pick up letters > in a careful order (so that you eliminate as much words as > possible at each pick), you will end up always to the same > word! > If you use the /usr/dict/words file, try this sequence: > a,e,i,o,u. You will end up with only two words: 'rhythm' and > 'nymphs'. Simply pick the letter 'y', and you will know > which word was picked. You can now win easily, since you > know the word to find. Heh. I tried that with the ENABLE word list, and found that it contains the word 'tsktsk'. :) BTW, note that the contents of the /usr/dict/words file is system dependent. (Actually, so is the file's location. Any program which uses a word list should have an option for specifying an alternate path to the word list file.) > Rich Morin wrote: > > I also found that I had to cheat (i..e., peruse Camel III) to > > figure out what was going on, particularly in partition_words. > > You can easily skip the partition_words sub. Perl provides > the grep function that is more convenient. But less memory efficient, because it builds a copy of the original array. partition_words modifies the array in place. I wouldn't be surprised if the grep were faster, though. Ronald ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe