28 lines
587 B
C++
28 lines
587 B
C++
#include "Player.hpp"
|
|
|
|
#include <stdlib.h>
|
|
|
|
class Anon2 : public Player {
|
|
public:
|
|
Anon2() {
|
|
name = "Anon2";
|
|
}
|
|
|
|
int cooperation_metter;
|
|
|
|
void new_game() override {
|
|
cooperation_metter = 0;
|
|
}
|
|
void push_result(reaction_t opponents_last_reaction) override {
|
|
if (opponents_last_reaction == COOPERATE) {
|
|
cooperation_metter += 10;
|
|
} else {
|
|
--cooperation_metter;
|
|
}
|
|
}
|
|
|
|
reaction_t play() override {
|
|
return (cooperation_metter > 15) ? (cooperation_metter += 2, COOPERATE) : CONFLICT;
|
|
}
|
|
};
|