attack.realAttack = RandomAttack();
- /* Here we choose the thing that will hurt them if they go for a tie */
+ /* Here we choose the thing that will hurt them if they go for the kill */
switch (attack.realAttack) {
case rock:
result.promisedAttack = paper;
break;
case paper:
- result.promisedAttack = rock;
+ result.promisedAttack = scissors;
break;
default: /* attack = scissors */
- result.promisedAttack = paper;
+ result.promisedAttack = rock;
break;
}
- attack.promisedAttack = result.realAttack; /* Tells the truth for its bluff */
-
return attack;
}
-/* Here we trust that they are telling the truth. And we try to kill them. */
+/* Here we assume they are lying, trying to kill us. And we try to kill them. */
ITEMTYPE Defend( char * foeName, ITEMTYPE foePromisedAttack ) {
ITEMTYPE defence;
switch (foePromisedAttack) {
case rock:
- defence = paper;
+ defence = scissors;
break;
case paper:
- defence = scissors;
+ defence = rock;
break;
default:
- defence = rock;
+ defence = paper;
break;
}
}
return; /* Ignore whatever just happened. */
}
+
+/* same for Cleanup() */
+
+void Cleanup() {
+ return;
+}