[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[QUIZ] Scrabble Stems (#12

James Gray

12/17/2004 1:46:00 PM

The three rules of Ruby Quiz:

1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.

2. Support Ruby Quiz by submitting ideas as often as you can:

http://www.grayproductions.net/...

3. Enjoy!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

by Martin DeMello

In Scrabble parlance, a 'bingo stem' is defined as a set of six
letters that combines with a large fraction of the alphabet to anagram
to valid seven letter words (a 'bingo' is a move using all seven tiles
on your rack). For instance, one of the more prolific stems, SATIRE,
combines with twenty letters, A, B, C, D, E, F, G, H, I, K, L, M, N,
O, P, R, S, T, V, W (forming words like ASTERIA, BAITERS, RACIEST
...).

Write a program that, given a word list and a cutoff n, finds all 6
letter stems that combine with n or more letters, sorted in order of
how many distinct letters they combine with.


21 Answers

Giovanni Intini

12/18/2004 12:17:00 PM

0

When talking of 6 letter stems, do I have to find all the 6 letter
stems that also have a meaning by themselves? (Like Satire for
example). Or may I find even nonsense stems?


On Fri, 17 Dec 2004 22:45:39 +0900, Ruby Quiz <james@grayproductions.net> wrote:
> The three rules of Ruby Quiz:
>
> 1. Please do not post any solutions or spoiler discussion for this quiz until
> 48 hours have passed from the time on this message.
>
> 2. Support Ruby Quiz by submitting ideas as often as you can:
>
> http://www.grayproductions.net/...
>
> 3. Enjoy!
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> by Martin DeMello
>
> In Scrabble parlance, a 'bingo stem' is defined as a set of six
> letters that combines with a large fraction of the alphabet to anagram
> to valid seven letter words (a 'bingo' is a move using all seven tiles
> on your rack). For instance, one of the more prolific stems, SATIRE,
> combines with twenty letters, A, B, C, D, E, F, G, H, I, K, L, M, N,
> O, P, R, S, T, V, W (forming words like ASTERIA, BAITERS, RACIEST
> ...).
>
> Write a program that, given a word list and a cutoff n, finds all 6
> letter stems that combine with n or more letters, sorted in order of
> how many distinct letters they combine with.
>
>


James Gray

12/18/2004 3:40:00 PM

0

On Dec 18, 2004, at 6:16 AM, Giovanni Intini wrote:

> When talking of 6 letter stems, do I have to find all the 6 letter
> stems that also have a meaning by themselves? (Like Satire for
> example). Or may I find even nonsense stems?

I don't believe the stems meaning or lack thereof is significant.

James Edward Gray II



Martin DeMello

12/18/2004 5:09:00 PM

0

Giovanni Intini <intinig@gmail.com> wrote:
> When talking of 6 letter stems, do I have to find all the 6 letter
> stems that also have a meaning by themselves? (Like Satire for
> example). Or may I find even nonsense stems?

No, all six letter stems count. The "meaningful" rearrangement is just a
handy way to refer to the stem.

martin

Glenn Parker

12/18/2004 9:43:00 PM

0

Ruby Quiz wrote:
>
> In Scrabble parlance, a 'bingo stem' is defined as a set of six
> letters that combines with a large fraction of the alphabet to anagram
> to valid seven letter words.
>
> Write a program that, given a word list and a cutoff n, finds all 6
> letter stems that combine with n or more letters, sorted in order of
> how many distinct letters they combine with.

If this quiz is really just about Scrabble, can we assume the input word
list will contain only 7-letter words?

If I filter my dictionary (2of4brif.txt) down to just 7-letter words, I
can handle this task in less than an hour of wall-clock time on a 2GHz
PC. If I allow all words with 7 or more letters, I don't know if I'll
be able to finish the processing in under a week's time.

I've certainly learned a few things about Ruby performance tuning along
the way.

--
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoi...


James Gray

12/18/2004 9:50:00 PM

0

On Dec 18, 2004, at 3:42 PM, Glenn Parker wrote:

> Ruby Quiz wrote:
>> In Scrabble parlance, a 'bingo stem' is defined as a set of six
>> letters that combines with a large fraction of the alphabet to anagram
>> to valid seven letter words.
>> Write a program that, given a word list and a cutoff n, finds all 6
>> letter stems that combine with n or more letters, sorted in order of
>> how many distinct letters they combine with.
>
> If this quiz is really just about Scrabble, can we assume the input
> word list will contain only 7-letter words?

I filtered out words less than and more than seven letters.

> If I filter my dictionary (2of4brif.txt) down to just 7-letter words,
> I can handle this task in less than an hour of wall-clock time on a
> 2GHz PC. If I allow all words with 7 or more letters, I don't know if
> I'll be able to finish the processing in under a week's time.
>
> I've certainly learned a few things about Ruby performance tuning
> along the way.

Hmmm, I would say that it doesn't HAVE to take that long. My program
runs in under 30 seconds. ;)

James Edward Gray II



Glenn Parker

12/18/2004 10:34:00 PM

0

James Edward Gray II wrote:
> Hmmm, I would say that it doesn't HAVE to take that long. My program
> runs in under 30 seconds. ;)

Thanks, stripping it down to handle only 7-letter words made a big
difference. It runs in well under 4 seconds now. :)

--
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoi...


Giovanni Intini

12/18/2004 11:49:00 PM

0

From the original post it looked like you could have anything longer than 6.


James Gray

12/19/2004 12:05:00 AM

0

On Dec 18, 2004, at 5:49 PM, Giovanni Intini wrote:

> From the original post it looked like you could have anything longer
> than 6.

In the game of Scrabble, you are limited to seven "tiles". You get 50
points when you can play all seven at once.

Technically, that could be in longer words (using letters already on
the board). I didn't get the impression this quiz was concerned with
that though.

James Edward Gray II



Glenn Parker

12/19/2004 3:16:00 AM

0

James Edward Gray II wrote:
> On Dec 18, 2004, at 5:49 PM, Giovanni Intini wrote:
>
>> From the original post it looked like you could have anything longer
>> than 6.
>
> In the game of Scrabble, you are limited to seven "tiles". You get 50
> points when you can play all seven at once.

The quiz alluded to Scrabble, but I have to agree that the phrasing was
still ambiguous about the length of the input words.

--
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoi...


Martin DeMello

12/19/2004 10:11:00 AM

0

Giovanni Intini <intinig@gmail.com> wrote:
> From the original post it looked like you could have anything longer than 6.

My bad, then - I meant six letter stems that form seven letter words
when combined with at least n out of the 26 letters in the alphabet.
There are seven-to-make-eight stems too, but as James noted, the quiz is
not concerned with them (it's a trivial extension, though).

martin