X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=link%2FC%2Fc-link-lib%2Fc_link.h;h=84e9bce766078731c80c3b1e67636531b96c70d0;hb=4597b27a44522a5c2785cc23029435f44f60ea55;hp=08cdb63548b59512b66ef2087be4c607c3d2af91;hpb=1740df9314f3dc49c6d44378c5915674aa1ab75f;p=progcomp10.git diff --git a/link/C/c-link-lib/c_link.h b/link/C/c-link-lib/c_link.h index 08cdb63..84e9bce 100644 --- a/link/C/c-link-lib/c_link.h +++ b/link/C/c-link-lib/c_link.h @@ -7,6 +7,8 @@ * */ +#include + #define MAXCOMMANDLEN 15 #define MAXFOENAMELEN 50 #define MAXITEMLEN 10 @@ -17,6 +19,9 @@ /* The type of item used in an attack or defence */ typedef enum {rock, paper, scissors} ITEMTYPE; +/* A result of a battle */ +typedef enum {win, lose, tie} RESULTTYPE; + /* An attack, consisting of the real attack and the attack promised */ typedef struct { @@ -28,6 +33,13 @@ typedef struct { /********** Utility Function definitions **********/ /* These are implemented in c-link.c, and automagically linked in */ +/* prints a debug message. Same arguments as printf(). + (you can't use printf because it is used to talk between + the agent and supervisor) + */ + +#define debugmsg(x...) sprintf(stderr, x) + /* Returns a random item */ ITEMTYPE RandomAttack(); @@ -37,6 +49,10 @@ ITEMTYPE RandomAttack(); extern char ITEMNAMES[3][MAXITEMLEN]; +/* Another useful table - what's the result of the + first item vs the second item? */ +extern RESULTTYPE RESULTOF[3][3]; + /********** Bot Function definitions **********/ /* You need to provide implementations for these to create a bot */ @@ -70,4 +86,12 @@ ATTACKTYPE Attack( char * foeName ); */ void Results( char * foeName, int isInstigatedByYou, ITEMTYPE yourItem, - ITEMTYPE theirItem, ITEMTYPE promisedItem); \ No newline at end of file + ITEMTYPE theirItem, ITEMTYPE promisedItem); + +/* Cleanup(); + + Called when your agent is no longer needed, either due to the round ending + or due to your agent being eliminated. + + */ +void Cleanup(); \ No newline at end of file