Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

wickline (135)

wickline
  (email not shown publicly)

Journal of wickline (135)

Sunday January 05, 2003
12:22 PM

jotto resources

[ #9776 ]

in response to an article in The Perl Review...

I also got interested in Jotto a while back. A friend had showed me how to play and I wanted to show another friend, but I found it frustrating discussing strategies when I knew the word I wanted them to guess. So, I wrote a script to play against.

        http://wickline.org/j/
        Interface rather undocumented

The script allows you to track most of the things you normally want to track on paper when playing without a computer. If you want to play in a masochistic fashion, you can ignore all those interface elements.

Here's my jott-counting code if you're interested

    sub get_jotts {
        my($probe, $target) = @_;
        my %letters;
        for ( split('',$target) )
            { $letters{$_}++ };
        my $jotts = 0;
        for ( split('',$probe)  )
            {$jotts++ if $letters{$_}-- > 0};
        return $jotts;
    }

Someone on a FWP list pointed out that you can optimize by generating a sub specific to the target word that in contexts where the sub will be called repeatedly with a single target word.

I've got a mammoth live-letter words list at

        http://wickline.org/fivers.tar.gz

I use a subset of that for my jotto game

        http://wickline.org/j/index.cgi?show=dict

I heard of the "killer" strategy for winning Jotto on the FWP list, and found it too boring to play against, so didn't bother with a head-to-head play version. The basic notion is that every guess must be a possible win. Every time the computer guesses, it must make a guess that could be the target word in light of the scores of previous guesses.

        select a number N between 1..5
        Sort dictionary, first by rough order of word commonality
                                          then by the Nth letter
                                          This will ensure that guesses use more
                                          common words before obscure ones, and
                                          that guesses aren't always alphabetically
                                          early... makes play a pinch more "real"
    PROBE:
        for each probe in dictionary
                next PROBE if we've already guessed this probe
                for each term in our history of guesses
                        next PROBE unless score given to term was
                                the same as it would get if probe were target
                if we get here, probe fits all term's scores
                        so return probe as our next guess
        if we get here, no probe worked
                        so we don't know the word (or user mis-scored us)

In practice, the above method gives very little chance for a human to win, and so I didn't find it very fun to play against.

Happy jotting. :)

-matt

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I tried contacting the author of the article by email, but my email bounced with (likely truncated) diagnostic code:

            smtp;550-Verification failed for
            It appears that the DNS operator for wickline.org has installed an
            invalid MX record with an IP address instead of a domain name on
            the right han

    First time I've seen that one, and I haven't changed any wickline.org DNS data in quite a while, so I
    • In response to your mail, no the Jotto module isn't available anywhere, yet, but I'd be happy to send it to you if you'd like. Your scoring algorithm seems much cleaner than mine, but I'd be interested to see what the speed differences are.

      The code in my Jotto.pm hasn't been touched in a while. I've been thinking about doing a complete rewrite of the Jotto stuff, now that I have a little bit more of a clue about what I'm doing.


      Kevin

      • > happy to send it to you if you'd like

        Count me interested :) You can email me at

        m-to_kevin-re_jotto [ at ] wickline.org

        I haven't gotten around to looking into that MX issue yet, so I'll have to reply back via use.perl.org until I do :)

        > interested to see what the speed differences

        I'll do a benchmark if I get a chance. ...and presumably if I've got a chance to contribute to the module, then I'll have a chance to do a benchmark.

        > thinking about doing a complete rewrite of the Jotto stu