31#ifndef __CLAW_GAME_AI_HPP__
32#define __CLAW_GAME_AI_HPP__
54 template <
typename Action,
typename Numeric =
int>
70 static score min_score();
71 static score max_score();
87 virtual bool final()
const = 0;
110 template <
typename Action,
typename Numeric>
114 action_eval(
const Action& a,
const Numeric& e);
116 bool operator<(
const action_eval& ae)
const;
139 template <
typename State>
151 typedef typename State::score
score;
153 score operator()(
int depth,
const state& current_state,
154 bool computer_turn)
const;
168 template <
typename State>
180 typedef typename State::score
score;
182 score operator()(
int depth,
const state& current_state,
183 bool computer_turn)
const;
186 score compute(
int depth,
const state& current_state,
187 bool computer_turn,
score alpha,
score beta)
const;
200 template <
typename Method>
205 typedef typename Method::state
state;
212 typedef typename Method::score
score;
214 void operator()(
int depth,
const state& current_state,
215 action& new_action,
bool computer_turn)
const;
228 template <
typename Method>
233 typedef typename Method::state
state;
240 typedef typename Method::score
score;
242 void operator()(
int depth,
const state& current_state,
243 action& new_action,
bool computer_turn)
const;
250#include <claw/game_ai.tpp>
Numeric eval
The score of the action.
Find an action with the alpha-beta algorithm.
State state
The type of a state in the game.
State::action action
The type of the actions that change the state of the game.
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.
Numeric score
The type used for evaluationg the players' scores.
static const score s_max_score
Maximal score that can be given to a state.
virtual void next_actions(std::list< action > &l) const =0
Get all actions that can be done from this state.
virtual game_state * do_action(const action &a) const =0
Get a new state obtained when applying an action.
Action action
A type representing an action of a player.
virtual score evaluate() const =0
Evaluate this state of the game.
Find an action with the MinMax algorithm.
State::score score
The type used to represent the score.
State state
The type of a state in the game.
State::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::score score
The type used to represent the score.
Method::state state
The type of a state in the game.
Method::action action
The type of the actions that change the state of the game.
Select a random action among the best ones.
Method::state state
The type of a state in the game.
Method::action action
The type of the actions that change the state of the game.
Method::score score
The type used to represent the score.
Everything about artificial intelligence related game algorithms.
Everything about artificial intelligence.
This is the main namespace.