// Planner.h // // Version Date Author Description // -------------------------------------------------------------------------- // 0.01 24/06/01 BWW Initial implementation // Define the basics #define true 1 #define false 0 // Screen size detail #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 // Speed setting for the dynamic events #define SPEED_LOW 3 #define SPEED_MEDIUM 2 #define SPEED_HIGH 1 // Complexity settings for the dynamic environment #define COMPLEXITY_LOW 3 #define COMPLEXITY_MEDIUM 2 #define COMPLEXITY_HIGH 1 #define COMPLEXITY 3 #define SPEED 2 #define STARTLOCATION 2 // Graphic object offsets #define OBJ_FLAT 'a' #define OBJ_UP 'b' #define OBJ_DOWN 'c' #define OBJ_WALL 'd' #define OBJ_WATER 'e' #define OBJ_START 'f' #define OBJ_EXIT 'f' #define OBJ_DOOR 'g' #define OBJ_BRIDGE 'h' #define OBJ_AGENT 'i' #define OBJ_KEY 'j' #define OBJ_CROSS 'k' #define OBJ_TICK 'l' #define OBJ_ROUTE 'm' // Environment Display #define ENV_SPRITESIZE 16 #define ENV_X 80 #define ENV_Y 0 // Environment Size #define ENV_WIDTH 10 #define ENV_HEIGHT 10 // Text Display #define TXT_SIZE_LARGE 4096 #define TXT_SPACE_LARGE 16 #define TXT_SIZE_MEDIUM 3072 #define TXT_SPACE_MEDIUM 12 #define TXT_SIZE_SMALL 2560 #define TXT_SPACE_SMALL 10 #define TXT_SIZE_VSMALL 2048 #define TXT_SPACE_VSMALL 9 #define TXT_SIZE_TINY 1792 #define TXT_SPACE_TINY 7 // Z depth display values #define ZPRIORITY_HIGH 0 #define ZPRIORITY_MED 1 #define ZPRIORITY_LOW 2 // Numbers of objects in the environment and values for statuses //#define DOORNUM 2 #define DOOROPEN 1 #define DOORCLOSED 0 #define DOORLOCKED 1 #define DOORUNLOCKED 0 //#define BRIDGENUM 4 #define BRIDGERAISED 1 #define BRIDGELOWERED 0 // Sprite data memory address #define MESSAGESPRITEADDR 0x80100000 // Set ordering table length #define OT_LENGTH 1 // Primitive related stuff //#define PACKETMAX 2048 #define PACKETMAX 1024 #define PACKETMAX2 (PACKETMAX*24) // Search tree #define SIZESEARCHARRAY 2000 #define SIZESEARCHDEPTH 32 // Define the Constants that will be used to link Action Effects to Goal Preconditions #define PRECON_AT 1 #define PRECON_DOORUNLOCKED 2 #define PRECON_DOOROPEN 3 #define PRECON_GETKEY 4 #define PRECON_PLAN 5 #define PRECON_WAIT 6 #define EFFECT_MOVETO 1 #define EFFECT_UNLOCK 2 #define EFFECT_OPEN 3 #define EFFECT_PICKUP 4 #define EFFECT_PLAN 5 #define EFFECT_WAIT 6 #define PARAM_OBJECTAGENT 1 #define PARAM_OBJECTDOOR 2 #define PARAM_OBJECTKEY 3 #define PARAM_XPOS 4 #define PARAM_YPOS 5 #define PARAM_LOCKSTATUS 6 #define PARAM_OPENSTATUS 7 #define PARAM_KEYSTATUS 8 #define PARAM_DURATION 9 #define NULL 0 #define MAXPRECON 10 #define MAXEFFECT 10 #define MAXUNMETPRECON 50 #define MAXACTIONEFFECT 50 #define MAXCAUSALLINKS 50 #define MAXORDERINGS 50 // Duration that the agent will 'wait' if a valid plan cannot be // constructed, before trying again & the 'thinking' time to put together // a plan #define DURATION_WAIT 250 #define DURATION_PLANSTEP 20 #define DURATION_UNLOCK 175 #define DURATION_OPEN 125 #define DURATION_PICKUP 150 // Plan constants #define PLAN 1 #define NOPLAN 2 #define FAILEDPLAN 3 // Global Typedefs typedef struct { int x,y,gotkey; } Agent_Struct; typedef struct { int x,y; } Key_Struct; typedef struct { int x,y; } Start_Struct; typedef struct { int x,y; } Exit_Struct; typedef struct { int x,y, doorstatus,lockstatus; } Door_Struct; typedef struct { int x,y,status,counter,duration; } Bridge_Struct; typedef struct { int numsteps, x[SIZESEARCHDEPTH], y[SIZESEARCHDEPTH],cost[SIZESEARCHDEPTH]; } Route_Struct; typedef struct { int numnodes; int parentnode[SIZESEARCHARRAY]; int goalnode[SIZESEARCHARRAY]; int xpos[SIZESEARCHARRAY]; int ypos[SIZESEARCHARRAY]; int accessibledirections[SIZESEARCHARRAY][4]; // hold cost to direction - heuristic order = E,S,N,W int costtonode[SIZESEARCHARRAY]; int cost[SIZESEARCHARRAY]; int nodedepth[SIZESEARCHARRAY]; int nodesinroute[SIZESEARCHARRAY][SIZESEARCHDEPTH]; // All of the other nodes in this particular route } SearchTree_Struct; typedef struct { int numgoalnodes; int lowestcostnode; int lowestcostvalue; int goalnode[SIZESEARCHARRAY]; int costtonode[SIZESEARCHARRAY]; } SearchGoalNodes_Struct; // Structure to hold a Precondition or an Effect typedef struct { int condition; int parameter1; int value1; int parameter2; int value2; int parameter3; int value3; } Condition_Struct; // Array of potential Preconditions typedef struct { int numpreconditions; Condition_Struct condition[MAXPRECON]; } Preconditions_Struct; // Array of potential Effects typedef struct { int numeffects; Condition_Struct effect[MAXEFFECT]; } Effects_Struct; // Unmet preconditions typedef struct { int numpreconditions; Condition_Struct condition[MAXUNMETPRECON]; int met[MAXUNMETPRECON]; } UnmetPreconditions_Struct; // Preconditions available to be addressed by the next ActionEffect typedef struct { int numpreconditions; int available[MAXUNMETPRECON]; } AvailablePrecons_Struct; // Action Effects typedef struct { int numeffects; Condition_Struct effect[MAXACTIONEFFECT]; int duration[MAXACTIONEFFECT]; int executed[MAXACTIONEFFECT]; } ActionEffects_Struct; // ActionEffects available to be chosen as the next action typedef struct { int numeffects; int available[MAXUNMETPRECON]; } AvailableActions_Struct; // Causal Links typedef struct { int numcausallinks; int actioneffect[MAXCAUSALLINKS]; int unmetprecondition[MAXCAUSALLINKS]; int executed[MAXCAUSALLINKS]; } CausalLinks_Struct; // Orderings typedef struct { int numorderings; int predecessor[MAXORDERINGS]; int successor[MAXORDERINGS]; int executed[MAXORDERINGS]; } Orderings_Struct; // Plan typedef struct { int status; int actioneffectindex; int currentstep; int duration; int goalachieved; } Plan_Struct; // Metrics to be captured from the execution of the scenario typedef struct { int c_size; int c_accessible; int c_inaccessible; int c_dynamic_objects; int c_other_objects; int c_total_objects; int c_change; int c_complexity; int p_plannumber; int p_numpreconditions; int p_numactioneffects; int p_numcausallinks; int p_numorderings; int p_totplannumber; int p_totnumpreconditions; int p_totnumactioneffects; int p_totnumcausallinks; int p_totnumorderings; int e_preconditionsmet; int e_preconditionsfailed; int e_numsearches; int e_numsearchnodes; int e_numgoalnodes; } Metrics_Struct;