1efaa803e7313d284ec761d3d865bd681ae0eabc
[progcomp10.git] / link / C / Link / c-link-lib / sample-agents / c-angel.c
1 /*
2  *  c-angel.c
3  *  c-link-lib
4  *
5  *  Created by Daniel Axtens on 20/04/10.
6  *  Licensed under an MIT-style license: see the LICENSE file for details.
7  *
8  */
9
10 #include <c-link.h>
11
12 /* Implement the angel bot, which always tells the truth
13    and expects others to do the same */
14
15 ATTACKTYPE Attack( char * foe_name ) {
16         ATTACKTYPE attack;
17         
18         attack.realAttack =  RandomAttack();            /* Chooses randomly from Rock, Paper, Scissors */ 
19         attack.promisedAttack = attack.realAttack;      /* Tells the truth for its bluff */
20
21         return attack;
22 }
23
24 ITEMTYPE Defend( char * foeName, ITEMTYPE foePromisedAttack ) {
25         return foePromisedAttack;       /* Trusts them to be going for a tie */
26 }
27
28 /* You need to define a results function, even if it isn't used
29    (otherwise the linker will complain) */
30 void Results( char * foeName, int isInstigatedByYou, ITEMTYPE yourItem, 
31                          ITEMTYPE theirItem, ITEMTYPE promisedItem) {
32         
33         return; /* Ignore whatever just happened. */
34 }

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