Telephone Words

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]




Search WWW


As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.


Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 


We receive a few cents from each purchase.  Thanks


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)


Feedback:  Send an e-mail with your comments about this program (or anything else).

Search only




Problem Description

This  "Telephone words" program converts number strings into words based on standard keypad number-to-letter assignments as illustrated here (e.g. 43556 ==> HELLO).

Background & Techniques

Businesses like phone numbers that can be presented as words with the idea that they are easy to remember.   I (and probably most callers) dislike them because it slows and complicates the dialing process.   But they do make interesting puzzles.  

One of the restriction when extracting words from numbers is that "0" and "1" have no associated letters.  In this program, "0"s are ignored and "1"s treated as space characters thus creating multiple-word numbers.  

 Users  can enter an arbitrary number strings to see possible translations.  A set of test words that can be translated by clicking is included.   Translations can be by clicking on test words provided.   For long words, the chance having multiple translations is slim but for shorter mutli-word number, more than one word may have multiple trnslations.  The program will display separate "solutions" for each combination of multi-word strings.  For example try translating "46631364" to get "GOOD DOG" and 13 other possibilities.

Non-programmers are welcome to read on, but may want to jump to bottom of this page to download the executable program now.

Programmer's Notes:

Recursion (routines that call themselves) come to the rescue twice In this program:

bulletGenWords takes a single number set and loops through the possible letters that each number could represent.   For example, 364 (DEF, MNO, GHI) checks the 9 combinations from DMG through through FOI.    Of these only two (DOG and FOG) are valid words.  For efficiency, a call to the dictionary function  LookupPartial truncates searches like DM and DN without checking the third letters.  The full word check Lookup function is called after all letter positions have been processed in order to validate and save real words. 
bulletAll translations of each word are saved as entries in an array of  string lists.  Recursive procedure GenAnswers generates all combinations of words by selecting one word  from each list to form an answer phrase.  each call to GenAnswers loops though all words in a single list, adding the next word in its list to the answer being buid and calling itsself to process the next word list.  The last word list procesessor displays the completed phrase as a lime in the solution TMemo.      

One more note: The source download includes a version of he UDict dictionary unit with a minor change that allows LookupPartial to accept the letter D (as in DOG) as a partial word.   DFFLIBV15 has been updated with the change (and D removed as an abbreviation in Fulll.dic), but no need to re-download it now.


Running/Exploring the Program 

bulletDownload  executable
bulletDownload source (Note: the UDict unit the Fulldic dictionary reside in our library zip file of commonly used units.  Library file DFFLIBV15 or later is required to recompile this program )
bulletDownload current library file (DFFLibV15) required to recompile TelephoneWords.


Suggestions for Further Explorations

Adding the reverse encoding (words to numbers) should be a straightforward enhancement to the program.. 


Original:  April 28, 2018

Modified:  May 15, 2018

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2018, Gary Darby    All rights reserved.