Rules Scroll To Bottom


rules

Introduction

This article explains how the clues in a logic puzzle may need to be expressed as Rules. Rules are needed only if all of the clues in a logic puzzle cannot be expressed as Facts. While facts are static statements such as "A is next to B", rules are conditional statements such as "If A is next to B, then C is not next to D". Rules are similar to Laws, but are specific to a logic puzzle. If we look at the logic puzzle "All Tired Out", clue 7 states "Grace stood next to at least one man in line." This clue cannot be expressed by facts, so it must be implemented as a rule. Rules, along with Links, require programming. A rule usually does something based on the Marks, and may perform one or more of the following tasks. Here are the rules for our example logic puzzle.

You can enable/disable a rule by clicking its checkmark. Here are the rules after our puzzle has been solved.

Violations

A violation occurs when a mark contradicts the clues of a puzzle. A mark that violates the clues is called a contradiction. This should only happen when Assumptions are made. A violation means the program should undo the last assumption, and make another one. If an assumption was not made, this is a fatal logic error, and the program will stop solving the puzzle. In our example puzzle, if a mark created the situation where Grace was first and a woman was second, this mark would contradict the clues. When a rule encounters this, it must inform the program of the violation.

Triggers

A rule that examines the current mark to enter additional marks is called a trigger. The status of a trigger is the status of the submitted mark. If there are no problems with the mark, the status is zero. If there is a problem with the mark, the status is negative, and is returned immediately. If the mark entered by a trigger is rejected, this is the same as a rule violation. If the trigger was successful, the current rule can continue, and additional rules can be invoked.

In our example puzzle, a rule must look for a situation such as "If no man can be 2nd in line, then Grace cannot be 1st in line." When this situation is found, the rule enters 'X' for 1st and Grace. In general, rule violations should be handled first, followed by triggers.

Placeholders

Some logic puzzles may not give you all of the values of the nouns. This means the values must be calculated by a rule. Nouns where the initial value is unknown are called Placeholders. Usually these values are numeric, such as the number of people who attended a talk in "Astrophysics Conference", or the age of a salesperson in "Dandy Salespeople". Rules that update placeholders can be quite complex.