Instance Property

facts

The list of facts claimed by the rule system.

Declaration

@property(nonatomic, retain, readonly) NSArray *facts;

Discussion

A fact is any object representing a truth claimed by the rule system. You can use any type of object to represent the facts in your system: simple data types like strings and numbers typically suffice, but you can also use custom objects from your game’s data model.

Each fact has a membership grade ranging from zero to 1.0, representing variable levels of truth, strength, or confidence for use in fuzzy logic. Asserting a fact increases its grade, adding it to the array if not present; retracting a set reduces its grade, removing it from the array if its grade drops to zero. Use the methods listed in Drawing Conclusions from Facts to examine the grade of a fact or of a combination of facts.

See Also

Asserting and Retracting Facts

- assertFact:

Adds the specified fact to the fact set with a membership grade of 1.0, and reevaluates the rules in the system’s agenda.

- assertFact:grade:

Increases the membership grade of the specified fact by the specified amount, adding it to the fact set if necessary, and reevaluates the rules in the system’s agenda.

- retractFact:

Removes the specified fact from the fact set, and reevaluates the rules in the system’s agenda.

- retractFact:grade:

Reduces the membership grade of the specified fact by the specified amount, removing it from the fact set if necessary, and reevaluates the rules in the system’s agenda.