All pastes #1831569 Raw Edit

Untitled

public c v1 · immutable
#1831569 ·published 2010-03-10 10:17 UTC
rendered paste body
struct attriblist{  char *name;                     //name of this attribute  char *value;                    //value of this attribute  struct attriblist *first,*next; //ptrs to first and next attribute} attriblist;struct entity{  int   id;     //unique ID for this entity  char *name;   //user friendly name (if exposed to user)  int   type;   //used to determine what operations apply to this entity.} entity;struct fact{  struct entity *info;   //Entity Description  int   hops,            //How far from origin was this fact when we recieved it.        truth,           //How many times have we received it. (-1 for same fact negated)        flags,           //Flags to determine who we can tell this fact to.        negate:1;        //entity[0] IS or IS NOT entity[1]  struct object *subject; //The subject of the fact.  struct attriblist *attribute; //The subject is 'this'.  struct fact *first,*next; //Ptr to first and next fact.} fact;struct object{  struct entity *info;  struct fact *facts;            //List of facts  struct attriblist *attributes;} object;int ai_entity_id_counter, ai_memory_counter;struct entity *ai_create_entity(char *name, int type);struct attriblist *ai_create_attribute(struct attriblist *last, char *name, char *value);struct fact *ai_create_fact(struct fact *last, struct object *originator, struct object *subject, \                            char *attribname, char *attribvalue, int negate, int flags);struct object *ai_create_object(char *name, int type);void ai_destroy_object(struct object *o);void ai_init();