srand( time( NULL ) );\r
\r
char command[MAXCOMMANDLEN];\r
- char foeName[MAXFOENAMELEN];\r
+ char foeName[MAXAGENTNAMELEN];\r
char attItem[MAXITEMLEN], defItem[MAXITEMLEN], bluffItem[MAXITEMLEN];\r
char didYouInstigate[MAXBOOLLEN];\r
char winner[MAXRESULTLEN];\r
+ char uuid[MAXAGENTNAMELEN]; \r
int pointChange;\r
- void *thisInstance;\r
+ void *thisInstance = NULL;\r
\r
ATTACKTYPE attack;\r
ITEMTYPE defence;\r
\r
- /* generate a random id for this bot. Hopefully it's unique\r
- I can't use the UUID, because python doesn't pass it to me! */\r
- me = rand();\r
- \r
- // TODO: Get the UUID passed by python\r
- // Currently, just pass an empty string to the initialise function\r
- thisInstance = Initialise( "" );\r
- \r
scanf( "%s", command );\r
\r
while (strcasecmp("BYE",command) != 0) {\r
\r
- if (strcasecmp("ATTACK", command) == 0) {\r
+ if (strcasecmp("HI", command) == 0) {\r
+ scanf( "%s", uuid );\r
+ thisInstance = Initialise( uuid );\r
+ \r
+ } else if (strcasecmp("ATTACK", command) == 0) {\r
scanf( "%s", foeName );\r
attack = Attack( thisInstance, foeName );\r
printf("ATTACKING %s %s\n", ITEMNAMES[attack.realAttack], ITEMNAMES[attack.promisedAttack]);\r
scanf( "%s", command );\r
}\r
\r
- Cleanup(thisInstance);\r
+ if( thisInstance )\r
+ Cleanup(thisInstance);\r
\r
return 0;\r
}\r