applied TPG's patch, fixed wash
[progcomp10.git] / src / link / C / agents / c_lucifer.c
1 /*\r
2  *  c_lucifer.c\r
3  *  c-link-lib\r
4  *\r
5  *  Created by Daniel Axtens on 20/04/10.\r
6  *  Licensed under an MIT-style license: see the LICENSE file for details.\r
7  *\r
8  */\r
9 \r
10 \r
11 #include <c_link.h>\r
12 \r
13 /* Implement the lucifer bot, which always lies expecting people to be good\r
14    and always goes for the kill */\r
15 \r
16 void * Initialise( char * myName ) {\r
17         return NULL;\r
18 }\r
19 \r
20 ATTACKTYPE Attack( void * this, char * foe_name ) {\r
21         ATTACKTYPE attack;\r
22         \r
23         attack.realAttack =  RandomAttack();\r
24         \r
25         /* Here we choose the thing that will hurt them if they go for a tie */\r
26         switch (attack.realAttack) {\r
27                 case rock:\r
28                         attack.promisedAttack = scissors;\r
29                         break;\r
30                 case paper:\r
31                         attack.promisedAttack = rock;\r
32                         break;\r
33                 default: /* attack = scissors */\r
34                         attack.promisedAttack = paper;\r
35                         break;\r
36         }\r
37         \r
38         return attack;\r
39 }\r
40 \r
41 /* Here we trust that they are telling the truth. And we try to kill them. */\r
42 ITEMTYPE Defend( void * this, char * foeName, ITEMTYPE foePromisedAttack ) {\r
43         ITEMTYPE defence;\r
44         switch (foePromisedAttack) {\r
45                 case rock:\r
46                         defence = paper;\r
47                         break;\r
48                 case paper:\r
49                         defence = scissors;\r
50                         break;\r
51                 default:\r
52                         defence = rock;\r
53                         break;\r
54         }\r
55     return defence;\r
56 }\r
57 \r
58 /* You need to define a results function, even if it isn't used\r
59  (otherwise the linker will complain) */\r
60 void Results( void * this, char * foeName, int isInstigatedByYou, RESULTTYPE winner,\r
61              ITEMTYPE attItem, ITEMTYPE defItem, ITEMTYPE bluffItem,\r
62              int pointDelta ) {\r
63         \r
64         return; /* Ignore whatever just happened. */\r
65 }\r
66 \r
67 /* same for Cleanup() */\r
68 \r
69 void Cleanup( void * this ) {\r
70         return;\r
71 }\r

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