[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
|
|
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
|
![]() | How 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);
|
![]() | How 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.
![]() | Download source |
![]() | Download executable |
![]() |
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. |