OT: Another NPR puzzle

Alex Tweedly alex at tweedly.net
Sun Aug 28 20:37:17 EDT 2005


Jim Hurley wrote:

> Here is another NPR (National Public Radio) puzzle:
>
> "From listener Frank Morgan, a mathematician at Williams College. (He 
> also has a puzzle page at mathchat.org.) Think of a word whose meaning 
> you can make plural by adding an A at the start. Start with a very 
> common singular noun, add the letter A at the beginning, and you'll 
> make the meaning plural. What word is it?"
>
> Note that the "meaning" is made plural, not the word itself.
>
> The straightforward approach is not very fruitful. Listing all words 
> which can be derived by  pre-pending the letter "a" yields 559 words. 
> Hard to find the word satisfying the conditions of the puzzle from so 
> large a list.
>
> The best I was able to do was a list of 103 words to choose from. (I 
> realize that that statement is enigmatic.)
>
> To save time it is imperative that the dictionary be converted to an 
> array, i.e. for each word (tWord) in the dictionary:
>
>     put  true into dictArray[tWord]
>
> The dictionary is  compressed in a custom variable--see the "Get 
> started button."
>
> This is harder than the last NPR  puzzle. In the message box run:
>
>    go stack url "http://home.infostations.net/jhurley/NPRpuzzle.rev"
>
> It is a large file (370k) so be patient.

Interesting. Unfortunately, I know the answer because I spotted it 
looking at the 559 word list, before I got on to the next part - so that 
limits the amount I can do to improve the list without risk of  using 
that knowledge to do so.

I applied a few safe heuristics but those only got it down to 470 
alternatives.

code ahead - don't read further unless you want to read code now ....













The hard work of the search, I did in 181 msecs as

> repeat for each line t in tDict
>     if char 1 of t = "a" or char 1 of t = "A" then
>       if t = lower(t) and the number of chars in t > 3 then
>         put true into wDict[char 2 to -1 of t]
>       end if
>     else
>       if wDict[t]  and t = lower(t) then put t & cr after tResult
>     end if
>   end repeat
>  

or in half that time (90 - 92 msecs) as

>   put true into stillOnA
>   repeat for each line t in tDict
>     if stillOnA then
>       if char 1 of t = "a" or char 1 of t = "A" then
>         if t = lower(t) and the number of chars in t > 3 then
>           put true into wDict[char 2 to -1 of t]
>         end if
>       else
>         put false into stillOnA
>         if wDict[t]  and t = lower(t) then put t & cr after tResult
>       end if
>     else
>       if wDict[t] and t = lower(t) then put t & cr after tResult
>     end if
>   end repeat
>   





-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.16/83 - Release Date: 26/08/2005




More information about the use-livecode mailing list