[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
Many of the 10 given three-letter partial words have more than one choice of
final letter to form a common four-letter English word. Use all
of the supplied letters exactly once to fill the blanks and complete all these
Background & Techniques
Source: 2014 Mensa Puzzle-A-Day Calendar for June 12, 2014. Finding the solution is a matter of uniquely matching each of the three-letter partial words with one of the the given 4th letters. For example TEA_ could form TEAL, TEAK or TEAM. using the L, K, or M given letters.
To solve the puzzle, users select each partial word and and then click the letter to complete the word. The program uses the included dictionary to verify that the 4 letters form a valid word before accepting it. Clicking a completed word will remove the 4th letter and make it available for use elsewhere when mistakes are discovered.
Non-programmers are welcome to read on, but may want to jump to bottom of this page to download the executable program now.
A TStringList, Words, contains the 10 partial words. The "OnClick" exit uses the DFF LineNumberClicked function to save the line index in variable SelectedWord. If the 4th character is underscore ("_"), we just append '<==' to the word to provide a visual indication of the current selection. If the 4th character is not "_", the letter has already be placed there and the user is requesting that it be removed. In this case, we replace the 4th letter with "_", append the "<==" selected indicator to the word, and replace the removed letter into the its original position in the Lettergrid TStringGrid.
Lettergrid contains the 10 available letters in a 1 x 10 TStringGrid. An "OnClick" event exit, checks that there is a letter in the row clicked and there is a valid Selectedword value pointing to the Words TStringList. The Lookup function in our UDict library unit validates the word. If valid, the letter is placed in position 4 of the SelecetedWord entry, and we replace that letter in LetterGrid with a space character.
Our UDict library unit and the Full.dic dictionary file are used to verify that words formed by users are valid.. The DOR_ partial word required an addition to the dictionary which is included with each zip file but I also included a program check for this word so probably no need to replace your current Full.dic dictionary for this minor change.
Suggestions for Further Explorations
Copyright © 2000-2018, Gary Darby All rights reserved.