Scrambled Letter Blocks

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

 

 

Search

Search WWW

Search DelphiForFun.org

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.)

Contact

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

Search DelphiForFun.org only

 

 

 

Problem Description

From the October 17, 2011 page of my 2011 Mensa 365 Brain Puzzlers Calendar

Form six 9-letter words by combining two 3-letter blocks found below with endings already placed in the grid. All blocks will be used. If you do it correctly, one of the vertical columns will spell a bonus word.

Use these groups to complete the words in the grid: AFT, ARC, BET, DEM, ERG, HEN, KEB, ROT, SCO, SNA, UND, YST



Background & Techniques

This is one of a number of puzzles in the Delphi Techniques section of DFF rather than in the Projects section.   It is not always clear which programs should qualify, but I decided to to locate this one here because it has two behaviors that I must relearn each time I use them:

bulletHow to determine a mouse click line number in a TMemo:

In the OnClick event exit, property SELSTART will contain the offset of the clicked character within the TEXT property.  To convert SelStart  to the line number and character within the line use

LineNumber:=Perform(Em_LineFromChar,Selstart,0);

Although not used in this program, the clicked position within the line string could be found by getting the index of the beginning of the clicked line and subtracting that number from SelStart thus:

 LineIndex:=Perform(Em_CharFromLine,LineNumber,0);
CharPosition:=Selstart-Lineindex+1;

 

bulletHow to determine a mouse click location on a TStringGrid:

In the OnClick event exit, properties COL and ROW will indicate the location of the cell clicked.

The first version of the program used our TDict dictionary unit to identify when valid words were built and the "Search" button used a recursive GetNextWord function to find all solutions.  In the final version I replaced the dictionary calls with a simple string list, Answers,  lookup to identify the 6 words and decided to eliminate the recursive nature of the function so that it only returns one word per button click.   This allows the user to find  words as a way to reduce the size of the search space.  Additionally, I now can identify all 6 solution words - the one reptilian answer word was missing even from our largest dictionary until recently.

Running/Exploring the Program 

bullet Download source
bulletDownload  executable

Suggestions for Further Explorations

Additional puzzles of the same type would be easy to manually construct and use if we just added the ability to load other puzzles from a text file.
By reintroducing our dictionary unit, it should even be feasible to automatically construct additional puzzles.

 

Original:  October 21, 2011

Modified:  May 15, 2018

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