A Programming Language for Cognitive Agents: Goal Directed 3APL