Fun project but fuzzy on logic. "PhoneCALLs"

Andy Burns yoy at comcast.net
Sat Sep 20 17:57:01 EDT 2003


Hi folks,

I remember a program that you could type in your phone number and it would
give you all permutations of what possible words could be formed.

I just wanted to see how easy it was. Well... I'm really stumped on the
logic.

Here's the script that belongs in a field "phoneNumber" (where you type in
the phone number).

##BEGIN Script

on returninfield

#put empty into fld "phoneCalls"

put 1 into n
put 1 into z

repeat for each char x in fld "phoneNumber" # limited to seven digits for
now

 if x = "-" then
  add 1 to n
  next repeat
 else
  put x into item z of phoneNumber
  add 1 to z
 end if
end repeat

put "1 1,2 A B C,3 D E F,4 G H I,5 J K L,6 M N O,7 P Q R S,8 T U V,9 W X Y
Z,0 0" into phoneCalls

split phoneCalls by comma and space

put phoneCalls[item 1 of phoneNumber] into number1
put phoneCalls[item 2 of phoneNumber] into number2
put phoneCalls[item 3 of phoneNumber] into number3
put phoneCalls[item 4 of phoneNumber] into number4
put phoneCalls[item 5 of phoneNumber] into number5
put phoneCalls[item 6 of phoneNumber] into number6
put phoneCalls[item 7 of phoneNumber] into number7

put number1 & return into msg
put number2 & return after msg
put number3 & return after msg
put number4 & return after msg
put number5 & return after msg
put number6 & return after msg
put number7 & return after msg

end returninfield

##END Script


Determining the letters per number is in place but the logic to generate all
the permutations have been driving me nuts!

I look at the results in the message box and maybe I'm just dumb-for-a-day,
or maybe this isn't as easy as I thought. It will be quite a lesson learned
when I figure it out.

Thanks for any advice (hints, even). In the meantime, I'll continue to
attempt to devise a tree (?) to make it work.

All the best,

Andy Burns

"Dammit man, this isn't rocket science, it's brain surgery!"
--Montgomery Burns (The Simpsons)
.




More information about the use-livecode mailing list