A logic puzzle must have at least two noun types (say "First Name" and "Last Name"), and at least two nouns per type (say "John" and "Jane" are the first names, and "Smith" and "Doe" are the last names).
A logic puzzle must have the same three verbs. Verbs help you define the facts of the puzzle. The three verbs are:
Verb.IsNotusually has the name "is not" and is denoted by a 'X'.
Verb.Isusually has the name "is" and is denoted by a 'O'.
Verb.Maybeusually has the name "may be" and is denoted by a blank.
Note that the verb characters are what you enter in the grids you see in a logic puzzle magazine.
A logic puzzle must have at least one link, where the first link is the "with" link. If you see a clue like "John's last name is not Doe.", it has the verb "is not" and the link "with". You can see by this example that the link "with" is implied by the clue. In general, if you do not see an explicit relationship in a clue, use the link "with", defined as
And a logic puzzle must have at least one fact or rule. A logic puzzle without facts or rules is not really a logic puzzle, is it? Okay, let's begin with the nouns.
Reading the text of the puzzle you see that the four noun types are "Field", "First Name", "Last Name", and "Age". Note that I usually capitalize the names of the nouns when I first encounter them. The fields are "Mathematics", "Painting", "Sculpture", and "Violin", so there must be four nouns per type. The first names are "Grady", "Rose Anne", "Megan", and "Michael". The last names are "O'Keefe", "Riley", "Blumenthal", and "Elliot". The obvious ages are 16 and 14, so the other two ages still need to be determined, given the ages are from 9 to 20.
Clue 5 states the painter is 14 years old, two years older than Michael. This means Michael is 12 years old. We now have three of the ages - 12, 14, and 16.
Clue 4 states Megan is eight years older than the Elliot child (who isn't Rose Anne). If Megan is the oldest, she could be 20 (12 + 8), 22 (14 + 8), or 24 (16 + 8). But the oldest age allowed is 20, so Megan may be 20. If Megan is not the oldest, she may be 12, 14, or 16, which means another child would be 4 (12 - 8), 6 (14 - 8), or 8 (16 - 8). But since no child is less than 9, Megan can only be the oldest at 20. We now have all four ages: 12, 14, 16, and 20.
Note: If I was not able to easily calculate the ages, I would have a rule do that for me. The puzzle "Astrophysics Conference" does exactly that.
You may have noticed that clue two presents unique nouns in terms of order. Since the puzzle does not ask for the solution in terms of order, and there are no other clues that involve order, I decided NOT to add another category ("Order") with the nouns "1", "2", "3", and "4".
Here are my nouns, grouped by type. Note that I sorted the nouns within each type.
|Field||First Name||Last Name||Age|
Most puzzles will give you all of the nouns. But some puzzles (even one-star puzzles) may make you work to find all of the nouns. Anyway, we have 4 noun types, with 4 nouns per type. Let's move on to the links.
Next, I want to examine the clues for the relationships in the puzzle. I found the following relationships.
Question: how do you tell a program what it means for two nouns to be "more than 4 years apart"? I will answer that question when I discuss the puzzle module.
Facts tie together the nouns, verbs, and links you found in the puzzle. Hopefully, all of the clues can be expressed as facts. Otherwise, you will need rules. The following clues can be expressed as facts.
When it comes to programming the facts in a puzzle module, you may find it vexing how the nouns, verbs, and links are tied together. For example, clue two states that Rose Anne is not the violinist, but there is no noun called "violinist" (though we do have the noun "violin"). In Mystery Master terms, this clue means "Rose Anne is not with the violin." Don't worry, you'll catch on to the distinction (really).
As it turns out, all of the clues in the puzzle have been expressed as facts, so there are no rules for this puzzle. Yeah.
puzzle.addNounType("Noun type name")
puzzle.addLink("Link name", nounType);
puzzle.addFact("clue #", noun1, verb, link, noun2, "Fact name");
The real programming of a puzzle module is when you need to define links and rules. Fortunately, this puzzle does not need rules. But we do need to define our links, and that involves programming. Each link has a function that determines whether one noun is or is not related to another noun. It is implied that both names have the same noun type as the link. We never have to define the function for the first link "with", but we do for our other links: "more than four years apart from", "eight years older than", and "two years older than". Being able to program the links will make you an expert in constructing puzzle modules. Rhe noun type for these three links is "Age".
As you can see, our functions are defined using the noun's name, which is converted to a number via the
parseInt function. That is why we cannot use the SmartLink class.
Entering facts is easy compared to links and rules. To enter most facts, the basic format is:
puzzle.addFact("clue #", noun1, verb, link, noun2, "fact name");
Please see the complete puzzle module at /puzzles/js/ChildProdigies.js