[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
|
|
Problem DescriptionThis program uses predefined rules to apply predefined "letter sets" to a given set of phrases with unknown common characteristics looking for a rule that applies to all of them and to a single phrase in a second list of solution candidates. Background & TechniquesHere's a sample of what I call "Word Attribute" puzzles. I've have not had much success in solving this type , but usually think that I should have. This program provides two sample rules and two sets of letters which between them can lead to a solution. More significantly, it provides a template for solving future puzzles of this type.
Programmer's Notes:There is nothing particularly complex about the code for this one. The Search button initially performs embedded loops through
Rules display in a CheckListBox so they can be included or excluded from each search. If all of results the given "left column" phrases, match for a particular rule and letter set, the candidate phrases are tested and any passing are reported as solution. Of course, in a well constructed puzzle, there will be only one phrase that passes. Function ApplyRule is passed the rule number, the letter set and the phrase to be tested. It returns a TResultRec record which identifies the type of solution found (Boolean, String, or Integer) and the corresponding true/false, string, or integer array values. The current puzzle uses only the Boolean and Integer types. TResultRec does not definitively return pass/fail for the data it contains, only the value for the type of rule tested. The loop code which calls ApplyRule must determine the validity of the rule base on results for other phrases in the set being tested. ApplyRule calls a different unique function for each rule type. The two rule evaluation functions included in this initial release are PassesRule1 and PassesRule2. Running/Exploring the Program
Suggestions for Further Explorations
|
[Feedback] [Newsletters (subscribe/view)] [About me]Copyright © 2000-2018, Gary Darby All rights reserved. |