Hello Monks,
I have been playing a variety of games like Scrabble and wanted to work up a perl utility to tilt the game in my favor. I've been mulling on how to capture the garden variety scrabble-like game. Clearly we need some sort of filesystem to house the lexicon of the language in question. I usually do things in other languages than english, but let's start there, as that is the current target environment. I think the gals I play with who are currently beating me would be amused at having been tagged to be within a "target environment." They've consented to let me use a perl script to help me on my phone during games, so I've downloaded Termux, and now I need to write the utility.
My basic question goes like this: Given an array of m @letters, which represents the single character tiles of the games, what english words can be formed for any subset n of m?
I think that if I tried to write my own, that I would be reinviting the wheel in significant ways, so let me throw it out there: are you aware of any existing solutions to this?
Left to my own devices, I would start enumerating cases in lexicographic order and then checking against a library whether the resulting "word" is legal. The list of words that count seems to crazy to me, with many short ones that don't get used in contemporary speech and then the absence of words I use all the time, like "perl." This is my humble start:
C:\Users\tblaz\Documents\evelyn>perl 1.letters.pl letters are a g r t u i v b o ["a", "g", "r", "t", "u", "i", "v", "b", "o"] C:\Users\tblaz\Documents\evelyn>type 1.letters.pl #!/usr/bin/perl -w use 5.016; use Data::Dump; my @letters = qw(a g r t u i v b o); say "letters are @letters"; dd \@letters; __END__ C:\Users\tblaz\Documents\evelyn>
Greetings from the volcanic buttes of the Cascades, and thank you for your comment....
In reply to using perl to find words for scrabble by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |