// Rules. let rule1 = this.addRule("5", "Marge wasn't the second of the three women in line."); rule1.f = SmartRule.getIsNotBetween(this, rule1, slots, marge, grace, lisa); let rule2 = this.addRule("7", "Grace stood next to at least one man in line."); rule2.f = SmartRule.getIsRelated(this, rule2, grace, nextTo, [ethan, jeff]);
As you can see, a rule is entered via the puzzle method
this.addRule("clueNum", "Rule name.");
This puzzle also takes advantage of the methods in the SmartRule class.
// Rules. let rule1 = this.addRule("1", "No two boys auditioned for and play the same two roles."); let rule2 = this.addRule("10", "The Block youth got the part for which Pete auditioned.", [ block, pete ]);
The main purpose of a rule is to make sure the marks do not violate the rules. This is especially true if somebody wanted to manually solve the puzzle.
For the first rule, if actor 1 auditioned for role A but got role B, and actor 2 auditioned for role B but got role A, then this would be a violation.
A rule can also enter additional marks based on either the current mark, or on several existing marks. A rule that enters marks is called a trigger. It is important to note that having triggers can eliminate the need for assumptions.
For the first rule, if actor 1 auditioned for role A but portrays role B, then we can "trigger" a mark where an actor that auditioned for role B cannot portray role A.
This article is part of the "Build Logic Puzzles" series. Thank you.