Go to the documentation of this file.
31 #ifndef __CLAW_GAME_AI_HPP__
32 #define __CLAW_GAME_AI_HPP__
53 template<
typename Action,
typename Numeric =
int>
69 static score min_score();
70 static score max_score();
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;
239 void operator()(
int depth,
const state& current_state,
240 action& new_action,
bool computer_turn )
const;
247 #include <claw/impl/game_ai.tpp>
249 #endif // __CLAW_IA_JEUX_HPP__
A score associated with an action.
Method::score score
The type used to represent the score.
Method::action action
The type of the actions that change the state of the game.
State::action action
The type of the actions that change the state of the game.
Select a random action among the best ones.
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.
State::score score
The type used to represent the score.
This is the main namespace.
Method::score score
The type used to represent the score.
virtual score evaluate() const =0
Evaluate this state of the game.
virtual game_state * do_action(const action &a) const =0
Get a new state obtained when applying an action.
State::action action
The type of the actions that change the state of the game.
State state
The type of a state in the game.
Numeric eval
The score of the action.
Find an action with the MinMax algorithm.
Select an action using a given method (min_max, alpha_beta).
static const score s_max_score
Maximal score that can be given to a state.
Method::state state
The type of a state in the game.
Numeric score
The type used for evaluationg the players' scores.
State::score score
The type used to represent the score.
Find an action with the alpha-beta algorithm.
Method::action action
The type of the actions that change the state of the game.
static const score s_min_score
Minimal score that can be given to a state.
Method::state state
The type of a state in the game.
Action action
A type representing an action of a player.