unbroke large chunks
[progcomp10.git] / src / link / C / agents / c_lucifer.c
1 /*
2  *  c_lucifer.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
11 #include <c_link.h>
12
13 /* Implement the lucifer bot, which always lies expecting people to be good
14    and always goes for the kill */
15
16 ATTACKTYPE Attack( char * foe_name ) {
17         ATTACKTYPE attack;
18         
19         attack.realAttack =  RandomAttack();
20         
21         /* Here we choose the thing that will hurt them if they go for a tie */
22         switch (attack.realAttack) {
23                 case rock:
24                         attack.promisedAttack = scissors;
25                         break;
26                 case paper:
27                         attack.promisedAttack = rock;
28                         break;
29                 default: /* attack = scissors */
30                         attack.promisedAttack = paper;
31                         break;
32         }
33         attack.promisedAttack = attack.realAttack;      /* Tells the truth for its bluff */
34         
35         return attack;
36 }
37
38 /* Here we trust that they are telling the truth. And we try to kill them. */
39 ITEMTYPE Defend( char * foeName, ITEMTYPE foePromisedAttack ) {
40         ITEMTYPE defence;
41         switch (foePromisedAttack) {
42                 case rock:
43                         defence = paper;
44                         break;
45                 case paper:
46                         defence = scissors;
47                         break;
48                 default:
49                         defence = rock;
50                         break;
51         }
52     return defence;
53 }
54
55 /* You need to define a results function, even if it isn't used
56  (otherwise the linker will complain) */
57 void Results( char * foeName, int isInstigatedByYou, ITEMTYPE yourItem, 
58                          ITEMTYPE theirItem, ITEMTYPE promisedItem) {
59         
60         return; /* Ignore whatever just happened. */
61 }
62
63 /* same for Cleanup() */
64
65 void Cleanup() {
66         return;
67 }

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