artist has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I was playing a game at Yahoo: called Literati, It's cool game. You have to make different words from given choices and given position. You can take advantage of certain positions such as 2L( Double the letter value) or 3W( Double the Word value) or ignore certain postions (where in the next move the other player shoudn't take advantage). You can also make multiple words in certain situtation.

You can make use of powerful regular expressions to search the words from the dictionary server and write an algorithm which can maximize your advantage.

Would like to know if anybody has put it together such things.

Thanks,
Artist

Replies are listed 'Best First'.
Scrabble, anagrams Re: Literati
by andye (Curate) on Jan 14, 2002 at 18:29 UTC
    Here's a basic anagram-solver to start you off:
    #!/usr/bin/perl -w use strict; my @letters = qw(S C R A B B L); open(DICT,"/usr/dict/words") or die $!; while (<DICT>) { my $orig = $_; chomp; for my $letter (@letters) {s/$letter//i;} print $orig unless length; } close DICT;
    You might also want to look at this thread: "Countdown" (golf).

    Unfair to use this to cheat with, obviously. Intellectual interest only.

    hth,
    andy.

      Hi, Thanks, The program works good for the basics. Needs to be added are the weights to the letters to get the most rewarding word and few other things.

      The idea is just to have fun (intellectual interest) and nothing else. Writing the whole game for the same may enjoy programming but would kill the fun of interactive playing.

      Artist
      Artist

Re: Literati
by nooa (Beadle) on Jan 14, 2002 at 00:43 UTC
    After scanning through all related rules pages, I think this program is legal with Yahoo!. I think it's a great idea, but might it later haunt your conscience?

    He he. Maybe not.

    Two questions. What kind of ethics ride behind scripts that do more than just give an advantage, but completely play the game? For example, a script that plays online checkers or chess for you. How much better is a program that only gives an advantage?

    Second, what dictionary server were you planning on using?

Re: Literati
by elwarren (Priest) on Apr 07, 2002 at 00:12 UTC
    I just found WWW::Scrabble on aaronland today. Seems to do exactly what you're looking for. I was thinking about writing my own and just *knew* that someone else had already done this :-)
A reply falls below the community's threshold of quality. You may see it by logging in.