NPR puzzle

Lynch, Jonathan bnz2 at cdc.gov
Wed Jul 20 14:51:32 EDT 2005


Hi Ro...

Would your script go faster if you used lineoffset rather than 'is not
in'? 

If lineoffset(anElement,Gorp) = 0 then...


I ask because I am not which method is faster in which circumstances.

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Ro Nagey
Sent: Wednesday, July 20, 2005 2:31 PM
To: How to use Revolution
Subject: Re: NPR puzzle

Here's my humble submission:

on doIt
   put the ticks into startTime
   put fld "element" into gorp
   repeat for each line l in fld "words"
     put "Yes" into myAnswer
     put  l  into myWord
     put myWord into daWord
     repeat 5 times
       put char 1 to 2 of daWord into anElement
       delete char 1 to 2 of daWord
       if anElement is not in gorp then
         put "No" into myAnswer
         exit repeat
       end if
     end repeat
     if myAnswer contains "Yes" then put myWord & return after  
finalAnswer
   end repeat
   put the ticks-startTime into totalTicks
   answer totalTicks && finalAnswer && the number of lines in  
finalAnswer
end doIt

Did it in 2 ticks and found 23 words :)

Ro Nagey

Apologies in advance if you get this twice - the first one got held  
up because it was too long
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list