[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
|
|
Problem DescriptionGiven an anagrammed version of a common adage, unscramble it to its original form. Background & TechniquesHere is the January 23, 2013 puzzle in our "Brain Game" page-a-day calendar for this year. "NAIL BITING REFRESHES THE FEET" is an anagram for what common adage? What would have been very difficult without computer help was doable once an Internet search provided a list of sample proverbs. It took about 10 minutes of scanning the list by eye looking for items with two occurrences of the letter "F" and with no "O" to find the solution. It took about another 30 minutes and 75 lines of written code to implement a comprehensive version of this strategy using a downloaded text file of common adages ("Adage.txt" file is included in the downloads). Now I only hope that there are many similar puzzles this year! By the way, see this link for the difference between an "adage" and a "saying", "maxim", "saw", "motto", "epigram", "aphorism", or "proverb". Programmer's Notes:Adages were copied and pasted loaded into a text file "Adgae.txt" from 2 sites returned by Googling "Common adages". Our ClearBlankLines program was used to remove blank lines and leading blanks from the file. In the program, a LoadAdages button loads Adage.txt into a new TStringlist, AdageList. The list is sorted so that duplicates from the multiple sources can be eliminated. A TStatsObj object is defined with two fields: a Totalcount integer to be filled with the number letters in an adage and LetterCounts, a 26 integer array, indexed by characters "A' through 'Z'. Procedure Fingerprint fills TotalCount and LetterCounts from a passed string parameter. One of these "fingerprint" objects is created for each adage inAdagelist and saved in the Objects property. A TEdit control, Edit1, is prefilled with the Nail Biting adage, but others could be keyed or pasted in for future problems. The CheckIt button creates the fingerprint for the anagram and then passes against the fingerprints stored as objects in Adagelist. If an adage is found whose fingerprint matches the anagram, a solution is reported. Addendum: April 1, 2013 - The file "Adages.txt" was omitted from the original posting; it now included in either of the downloads. Running/Exploring the Program
Suggestions for Further Explorations
|
[Feedback] [Newsletters (subscribe/view)] [About me]Copyright © 2000-2018, Gary Darby All rights reserved. |