--
This commit is contained in:
31
miscellaneous/game_theory/source/Player.hpp
Normal file
31
miscellaneous/game_theory/source/Player.hpp
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef PLAYER_H
|
||||
#define PLAYER_H
|
||||
|
||||
typedef enum {
|
||||
COOPERATE,
|
||||
CONFLICT,
|
||||
} reaction_t;
|
||||
|
||||
class Player {
|
||||
public:
|
||||
/* Gathered points during the game are stored internally
|
||||
*/
|
||||
long points = 0;
|
||||
/* This is for logging the game
|
||||
*/
|
||||
const char * name;
|
||||
/* Called before facing a new opponent
|
||||
*/
|
||||
virtual void new_game() = 0;
|
||||
/* Called during a match;
|
||||
* the return value is your response
|
||||
*/
|
||||
virtual reaction_t play() = 0;
|
||||
/* Called after the match;
|
||||
* the argument signals what your opponent played;
|
||||
* you may use/store this information as you wish
|
||||
*/
|
||||
virtual void push_result(reaction_t opponents_last_reaction) = 0;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user