APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Mac OS X Scrabble Word Trainer with Growl

As I mentioned at Internet Scrabble (the name Scrabble is a trademark of Hasbro, Inc. in the United States and Canada and of Mattel elsewhere), our family has been enjoying playing Scrabble on-line. Aside from the fun of playing, it gives us another reason to keep in touch with each other - the small interactions in the chat windows are part of our involvement in each others lives.

i have also been playing with strangers. When I first started that, I was a little shocked by some of the word usage. In our family games, we had never allowed slang, abbreviations, or foreign words. If you had a Q and no U, you were stuck - there was no QI or QAT or QANAT in our games. Isn't that why a Q is worth 10 points? If all it takes is an I to play it, it shouldn't be worth much more than H, should it?

Well, that's not how Scrabble is played today. Foreign words, abbreviations, old English and slang have found their way into TWL (The Word List). It almost seems that you can toss down three or four random letters and have a good chance of being able to create a valid Scrabble word.

Of course you have to know the words. With the Facebook version, you can guess and let the dictionary correct you, but if you ever want to play face to face, that won't work. You need to learn more words.

Not just any words, though. While a large vocabulary isn't a bad thing to have for Scrabble, you can improve your scores by just concentrating on the two and three letter words plus a few other odd words that use the high scoring letters. Add to that the "aa" and "ii" words (for those times when you get a rack full of them), take away the obvious stuff that you already know, and you'll be left with less than 1,000 words, give or take. That's a fair pile to memorize, though not impossible.

If I were younger, I probably would just memorize those words. I think I probably still could, but instead I let my computer help me learn them. That's easier on my tired old brain.

I made a list of the words I want to learn. I added to it the words that that I have a hard time accepting as legal plays like "AB", "SIM" and a few other abbreviations I just don't think of as words. I added a ":" and then a definition for each word - I find it much easier to remember words if I know what they mean. The final step was to write a program to present these to me randomly like flash cards.

My first effort was just a Perl script that randomly shuffles the list and then outputs each line to a terminal window. That was fine, but I had to have that window open to see the output. I wanted the words and definitions to be always visible to me - to appear on top of whatever else I happen to be doing, but to be translucent so that it wouldn't interfere too much. Hmmm.. sounds an awful lot like Growl.

I already use Growl for mail notification and the command line "growlnotify" was just what I needed. Here's what it looks like while running (click on the picture for a larger view). The Growl notification is in the upper right corner showing "KAE" at that moment. The simple Perl code follows.

growlnotify running

Code

#!/usr/bin/perl
use List::Util 'shuffle';
@s=<>;
@shuffled=shuffle(@s);
foreach (@shuffled) {
 $extra="";
 @s=split /:/;
 $word=uc($s[0]);
 $lword=$s[0];
 s/.*://;
 $extra="NO U! " if ($word =~ /Q/ and $word !~ /U/);
 print "\033[1m $word $extra \033[0m, $lword: $_\n";;
 open(O,"|/usr/local/bin/growlnotify $word $extra");
 print O "$lword $_";
 close O;
 sleep 7;
 # if you increase the default display persistence in Growl preferences, increase this also
}
 

I call that "scramble" and leave it running as "while :;do scramble mywords;done" (that way I can add words while it is running or have it use different lists).



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Mac OS X Scrabble Word Trainer with Growl

7 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Anthony Lawrence







Tue Jan 12 11:53:57 2010: 7899   TonyLawrence

gravatar


You can also do things like:

grep ".*ii.*:" mywords | scramble
# study the "ii" words

grep "^..:" mywords | scramble
# two letter words

The growlnotify is useful for studying or just being reminded of any sort of list - things you want to do this week or this year, words you never spell correctly, or anything else.



Sat Jan 16 18:19:50 2010: 7917   TonyLawrence

gravatar


You could easily bring this to Windows:

(link) has "growlnotify" so the only other thing you need is Perl and the above script.







Sat Apr 10 15:43:32 2010: 8396   NbvehMasala

gravatar


Hello!I would like to use ur method to study new vocabulary in foreign languages. I have Growl and growlnotify installed but not sure how to make it work...can u write little more, like about how install perl for growl(i know there's instruction of their website but it is simply not working, there's now "growl" in my user directory...), where to put the script, where to put word list... and how to make it run automatically for example when my system starts up))

Thank you!!



Sat Apr 10 21:53:48 2010: 8399   TonyLawrence

gravatar


You should have Perl already unless you are on Windows. Put the file anywhere you want - you just pass it on the command line. As to running it constantly, put it in StartUp Items.



Sun Apr 11 08:08:58 2010: 8402   nbvehMasala

gravatar


thank you!

so, "scramble" is the name of the script file and "mywords" is the name of the word list?

what about this part: "I call that "scramble" and leave it running as "while :;do scramble mywords;done" (that way I can add words while it is running or have it use different lists)", where should i perform this then? sorry, not familiar with perl and not that much with terminal either...

thank you!



Sun Apr 11 11:18:45 2010: 8403   TonyLawrence

gravatar


Yes, that's correct.

Let's say you have scramble and mywords in your home directory. Start up Terminal and type

while :
do
scramble.pl mywords
done &







Sun Apr 11 11:22:26 2010: 8404   TonyLawrence

gravatar


Ooops - typed too hastily. You'd do:

while :
do
./scramble mywords
done &

------------------------
Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Anyone who puts a small gloss on a fundamental technology, calls it proprietary, and then tries to keep others from building on it, is a thief. (Tim O'Reilly)





This post tagged: