31 #ifndef __CLAW_GAME_AI_HPP__
32 #define __CLAW_GAME_AI_HPP__
53 template<
typename Action,
typename Numeric =
int>
76 virtual void next_actions( std::list<action>& l )
const = 0;
86 virtual bool final()
const = 0;
109 template <
typename Action,
typename Numeric>
138 template <
typename State>
149 typedef typename State::score
score;
152 (
int depth,
const state& current_state,
bool computer_turn )
const;
166 template <
typename State>
177 typedef typename State::score
score;
180 (
int depth,
const state& current_state,
bool computer_turn )
const;
184 (
int depth,
const state& current_state,
bool computer_turn,
198 template<
typename Method>
203 typedef typename Method::state
state;
209 typedef typename Method::score
score;
212 (
int depth,
const state& current_state,
action& new_action,
213 bool computer_turn )
const;
226 template<
typename Method>
231 typedef typename Method::state
state;
237 typedef typename Method::score
score;
240 action& new_action,
bool computer_turn )
const;
249 #endif // __CLAW_IA_JEUX_HPP__
A score associated with an action.
Select a random action among the best ones.
Method::score score
The type used to represent the score.
static score min_score()
Get the minimal score a state can get.
State::score score
The type used to represent the score.
Find an action with the MinMax algorithm.
State state
The type of a state in the game.
void operator()(int depth, const state ¤t_state, action &new_action, bool computer_turn) const
Select a random action among the best ones.
score fit(score score_val) const
Truncate a score to fit in the range (min_score(), max_score()).
Numeric eval
The score of the action.
Method::state state
The type of a state in the game.
Numeric score
The type used for evaluationg the players' scores.
Method::score score
The type used to represent the score.
static score max_score()
Get the maximal score a state can get.
virtual score evaluate() const =0
Evaluate this state of the game.
Action action
A type representing an action of a player.
static const score s_max_score
Maximal score that can be given to a state.
State::action action
The type of the actions that change the state of the game.
virtual void next_actions(std::list< action > &l) const =0
Get all actions that can be done from this state.
State state
The type of a state in the game.
action_eval(const Action &a, const Numeric &e)
Constructor.
State::score score
The type used to represent the score.
static const score s_min_score
Minimal score that can be given to a state.
Method::action action
The type of the actions that change the state of the game.
Select an action using a given method (min_max, alpha_beta).
Method::action action
The type of the actions that change the state of the game.
virtual ~game_state()
Destructor.
bool operator<(const action_eval &ae) const
Compare with an otreh action.
State::action action
The type of the actions that change the state of the game.
Method::state state
The type of a state in the game.
virtual game_state * do_action(const action &a) const =0
Get a new state obtained when applying an action.
Find an action with the alpha-beta algorithm.
Implémentation de fonctions d'intelligence artificielle.