facts: Map<string, number>
addRuleExecutingAction(predicate: Predicate$1, action: Action, salience?: number): void
Adds a rule which runs an action if its predicate evaluates to true.
parampredicate- Predicate to evaluate. A function taking the system as parameter.
paramaction- Action to execute. A function taking the system as parameter.
paramsalience- Priority of the rule.
addRuleAssertingFact(predicate: Predicate$1, fact: string, grade?: number, salience?: number): void
Add a rule which asserts a fact if its predicate evaluates to true.
parampredicate- Predicate to evaluate. A function taking the system as parameter.
paramfact- The fact to assert.
paramgrade- The optional grade to use when asserting the fact.
paramsalience- Priority of the rule.
addRuleRetractingFact(predicate: Predicate$1, fact: string, grade?: number, salience?: number): void
Add a rule which retracts a fact if its predicate evaluates to true.
parampredicate- Predicate to evaluate. A function taking the system as parameter.
paramfact- The fact to retract.
paramgrade- The optional grade to use when retracting the fact.
paramsalience- Priority of the rule.
addRule(rule: Rule): void
Add a custom rule.
paramrule- The rule to add.
Removes all rules.
Executes all rules for which the predicate evaluates to true.
assertFact(fact: string, grade?: number): void
Asserts a fact.
paramfact- The fact to assert.
paramgrade- The optional grade to use.
retractFact(fact: string, grade?: number): void
Retracts a fact.
paramfact- The fact to retract.
paramgrade- The optional grade to use.
Returns the grade for the specified fact.
paramfact- The fact to obtain the grade from.
returnsThe grade for the fact.
Returns the minimum grade for the specified facts.
paramfacts- The facts to obtain the minimum grade from.
returnsThe minimum grade for the facts.
Returns the maximum grade for the specified facts.
paramfacts- The facts to obtain the maximum grade from.
returnsThe maximum grade for the facts.
Resets the facts.