5 * Created by Daniel Axtens on 19/04/10.
6 * Licensed under an MIT-style license: see the LICENSE file for details.
10 #define MAXCOMMANDLEN 15
11 #define MAXFOENAMELEN 50
15 /********** Type definitions **********/
17 /* The type of item used in an attack or defence */
18 typedef enum {rock, paper, scissors} ITEMTYPE;
21 /* An attack, consisting of the real attack and the attack promised */
24 ITEMTYPE promisedAttack;
28 /********** Utility Function definitions **********/
29 /* These are implemented in c-link.c, and automagically linked in */
31 /* Returns a random item */
33 ITEMTYPE RandomAttack();
35 /* A useful translation table
36 eg printf( "I use %s.\n", ITEMNAMES[rock] ); */
38 extern char ITEMNAMES[3][MAXITEMLEN];
40 /********** Bot Function definitions **********/
41 /* You need to provide implementations for these to create a bot */
43 /* Defend( foeName : string - the name of your foe;
44 foePromisedAttack : ITEMTYPE - the item your foe promised to use
45 ) : ITEMTYPE - the item you wish to use to defend;
47 Called when your agent needs to defend itself.
50 ITEMTYPE Defend( char * foeName, ITEMTYPE foePromisedAttack );
53 /* Attack( foeName : string - the name of your foe
54 ) : ATTACKTYPE - the real and promised attack you wish to use
56 Called when your agent needs to attack another agent.
59 ATTACKTYPE Attack( char * foeName );
62 /* Results( foeName : string - the name of your foe;
63 isInstigatedByYou : 0=you defended/1=you attacked;
64 yourItem : ITEMTYPE - the item you used;
65 theirItem : ITEMTYPE - the item they used;
66 promisedItem : ITEMTYPE - the item that was promised
69 Called after your agent battles another agent, to tell you how the battle goes.
72 void Results( char * foeName, int isInstigatedByYou, ITEMTYPE yourItem,
73 ITEMTYPE theirItem, ITEMTYPE promisedItem);