Rules Scroll To Bottom


rules

Introduction

I will explain how the clues in a logic puzzle can be expressed as rules. Rules are needed when facts cannot represent the clues in a logic puzzle. 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".

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 represented 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 returns a status code. The status code is either negative for a violation, or zero for success. A rule may perform one or more of the following tasks.

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

Trigger Marks

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.

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

Conclusion

Rules are laws that are specific to a logic puzzle. If your comprehension of rules is somewhat "fuzzy", perhaps instead of logic puzzles you should look into something simpler like 3D Chess.