More work on C sample agents. Learning agents are a pain.
[progcomp10.git] / link / C / c-link-lib / c_link.h
index 08cdb63..84e9bce 100644 (file)
@@ -7,6 +7,8 @@
  *
  */
 
+#include <stdio.h>
+
 #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

UCC git Repository :: git.ucc.asn.au