Fun project but fuzzy on logic. "PhoneCALLs"

Geoff Canyon gcanyon at inspiredlogic.com
Sun Sep 21 13:01:01 CDT 2003


I'm not ;-)

Untested, but this would do it I think, trimming the recursion at the 
first point where it doesn't match. This assumes that the word list has 
a leading return, and the output now has a leading cr instead of a 
trailing cr:

local sSolution -- the output results of good words
local sWordList -- the list of good words. must have leading cr

on mouseUp
   put empty into sSolution
   doPerms cr,"2345678"
   put sSolution into fld 1
end mouseUp

on doPerms pString,pPhone
   if pString is not in sWordList then exit doPerms -- pruning here
   if pPhone is empty then
     put pString after sSolution
   else
     put char 1 of pPhone into tChar
     delete char 1 of pPhone
     repeat for each char c in item tChar of 
"1,abc,def,ghi,jkl,mno,pqrs,tuv,wxyz,0"
       doPerms (pString & c),pPhone
     end repeat
   end if
end doPerms

On Sunday, September 21, 2003, at 07:18  AM, Rob Cozens wrote:

>> A recursive solution would handle this nicely:
>
> Geoff, et al:
>
> Where are you checking to see the combinations of characters in 
> sSolution are legal words?
> -- 
>
> Rob Cozens
> CCW, Serendipity Software Company
> http://www.oenolog.net/who.htm
>
> "And I, which was two fooles, do so grow three;
> Who are a little wise, the best fooles bee."
>
> from "The Triple Foole" by John Donne (1572-1631)
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>

regards,

Geoff Canyon
gcanyon at inspiredlogic.com




More information about the use-livecode mailing list