X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=link%2FC%2Fc-link-lib%2Fc_link.c;h=680450e0255912ba77d5a2fd44a00927f1fb872b;hb=4597b27a44522a5c2785cc23029435f44f60ea55;hp=e75997f9b9e37d9026cffa47d0ceb27f821df158;hpb=1740df9314f3dc49c6d44378c5915674aa1ab75f;p=progcomp10.git diff --git a/link/C/c-link-lib/c_link.c b/link/C/c-link-lib/c_link.c index e75997f..680450e 100644 --- a/link/C/c-link-lib/c_link.c +++ b/link/C/c-link-lib/c_link.c @@ -14,12 +14,20 @@ #include /* You don't need to read this file. - This merely sets up the I/O for you, so all you have to do is define the bot - functions defined in + All you have to do is implement the bot functions defined in + This file sets up the I/O for you, as well as some utility functions and tables. */ char ITEMNAMES[3][MAXITEMLEN] = {"Rock", "Paper", "Scissors"}; +/* rock-rock rock-paper rock-scissors + paper-rock paper-paper paper-scissors + scissors-rock scissors-paper scissors-scissors */ + +RESULTTYPE RESULTOF[3][3] = { { tie, lose, win }, + { win, tie, lose }, + { lose, win, tie } }; + ITEMTYPE RandomAttack() { return (ITEMTYPE)rand()%3; @@ -73,5 +81,7 @@ int main( int argc, char * argv[] ) { scanf( "%s", command ); } + Cleanup(); + return 0; } \ No newline at end of file