jotto resources

wickline on 2003-01-05T17:22:03

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


Kevin: I was unable to email you

wickline on 2003-01-05T17:35:14

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 guess most folks are forgiving of that configuration error.

looking into this has been added to my todo list.

-matt

Re:Kevin: I was unable to email you

queue on 2003-01-06T13:26:34

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

Re:Kevin: I was unable to email you

wickline on 2003-01-06T21:33:29


> 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 stuff

I've had that on my todo list (regarding my CGI version) for a handful of years now. I forget who said it (Knuth?) but "always plan to throw the first one away" (or something like that).

Thanks :)

-matt