NPR puzzle
Mark Wieder
mwieder at ahsoftware.net
Thu Jul 21 23:29:33 EDT 2005
Dick-
Thursday, July 21, 2005, 2:19:37 PM, you wrote:
DK> Here's a solution that takes 10 milliseconds on a 1GHz PowerBook G4.
That's amazing. I optimized the heck out of my nested loop and it
still runs ten times slower than your array-based algorithm.
However... you're pulling a fast one here. You're getting away with
calling something a boolean when it actually isn't. Apparently
Transcript is letting you get away with this.
"if tSymbolArray[char 1 to 2 of tWord] then" should really be
"if tSymbolArray[char 1 to 2 of tWord] is not empty then"
Making the change slows things down on my machine from 14 milliseconds
to 18 milliseconds, making it about 30% slower, but still much faster
than anything I could do with repeat loops.
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list