Skip to main content

Intelligence

A class in Root.Township, Alta.Intelligence.

Unfinished experiment with a Prolog-like knowledge system (who owns, hates and attacked whom, with fading memories). Awake only builds a hard-coded test with frogs and toads and logs a query; no creature uses it.

Constructors​

MemberWhat it is
Intelligence()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
static readonly Atom<ITerm, ITerm> AttackedAtom for "A attacked B".
static readonly Atom<ITerm, IData<Vector3>> AttackedLocatedAtom for "the attacker of A was at position P".
static readonly Atom<ITerm, ITerm> EqualAtom for "A equals B", named "Equals".
static readonly Atom<ITerm> HatesAtom for "hates A".
static readonly Atom<ITerm, IData<Vector3>> IsLocatedAtom for "A is at position P".
static readonly Atom<ITerm, ITerm> OwnerAtom for "A is the direct owner (parent) of B".
static readonly Atom<ITerm, ITerm> OwnsAtom for "A owns B", directly or through a chain of owners.
1 private and internal field
MemberWhat it is
private History historyThe event history created in Awake.

Methods​

5 private and internal methods
MemberWhat it is
private void Awake()Builds the test knowledge (Everyone, Frogs, Fred, Toads, Ted), records Ted attacking Fred, and logs whether the frogs hate Ted.
private void BasicHate(Character character)Tells a group that it hates anyone who attacked one of its members.
private bool GetLastSeen(KnowledgeHolder knowledge, BaseAtom target, out Vector3 position, out float weight)Finds the highest-weighted known position of a target. Never called.
private Vector3? GetLastSeen2(KnowledgeHolder knowledge, BaseAtom target)Finds the highest-weighted known position of whoever attacked a target. Never called.
private void Update()Advances the history clock at a tenth of real time, ageing events.