NPR puzzle
Mark Wieder
mwieder at ahsoftware.net
Wed Jul 20 13:46:18 EDT 2005
Eric-
Wednesday, July 20, 2005, 7:52:08 AM, you wrote:
How'd you manage to get 30 milliseconds run time? The best I can do is
about 130. Is your machine just that much faster than mine? Here's the
fastest code I could come up with - any suggestions on speeding it up?
on mouseUp
local tLine, tTestString
local x
local tBlnPossible
local tDictionary, tElements, tPossibles
local tTime
put "working..." into field "status"
put empty into field "possibles"
put the milliseconds into tTime
put field "dictionary" into tDictionary
put field "elements" into tElements
repeat for each line tLine in tDictionary
put true into tBlnPossible
repeat with x=1 to 9 step 2
put char x to x+1 of tLine into tTestString
if tTestString is not among the lines of tElements then
put false into tBlnPossible
exit repeat
end if
end repeat
if tBlnPossible then
put tLine & cr after tPossibles
end if
end repeat
put the milliseconds - tTime && "milliseconds" into field "elapsed"
put tPossibles into field "possibles"
put "found" && the number of lines in field "possibles" \
&& "possible answers" into field "status"
end mouseUp
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list