bernie@fantasyfarm.com wrote: > boolean subroutine to determine whether a word matches > a probe/jots result; _fast_ is more important than small. So.... if I understand correctly, you're looking for a sub which 1) takes in a $guess, a $probe, and $jotts for that $probe 2) returns a boolean value: true if $guess is a possible match with target in light of $probe and $jots (with no information about the actual target word), false if not. What I'd do: Assume that $guess *is* the target word. Then, you can derive how many jotts $probe *should* have received. Return true if and only if the number of jotts derived is the same as the actual number of $jotts for $probe. So now the problem is reduced to finding the number of jotts a probe should get for a given target word. I don't know that this is the fastest way to do it, but this seems good to me: sub get_jotts { my($probe, $target) = @_; my %letters; for ( split('',$target) ) { $letters{$_}++ }; my $jotts = 0; for ( split('',$probe) ) {$jotts++ if $letters{$_}-- > 0}; $jotts; } > 'jotto player' that uses that -very- nasty algorithm I'd be interested in seeing that :) If it's of any use, help yourself to jotto-related code at http://wickline.org/saog/index.cgi/spew_source I tried playing someone using that very nasty algorithm (human/human play... no FWP). The first time, I got the target in only five guesses! I figured that this was *the* strategy and I should use it in every jotto game henceforth. Unfortunately, it turns out that I had just been incredibly lucky. Every time after that, whenever I tried to use the strategy, my lack of brute force access to a giant dictionary really got in the way: I couldn't keep comming up with good guesses in any reasonable amount of time. That sort of processing just isn't the strongest suit for human grey matter :) -matt ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe