1 /*******************************************************************
2 *
3 * This file is part of the KDE project "Bovo"
4 *
5 * Bovo is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * Bovo is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Bovo; see the file COPYING.  If not, write to
17 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 ********************************************************************/
21 
22 
23 #ifndef BOVO_AI_IMPL_H
24 #define BOVO_AI_IMPL_H
25 
26 #include <QLinkedList>
27 
28 #include "ai_interface.h"
29 #include "standing.h"
30 
31 typedef QLinkedList<Standing> previous_standings_T;
32 
33 class AiImpl {
34 public:
35 	AiImpl();
36 	virtual ~AiImpl();
37 
38 	// the width of the table
39 	pos_T table_size_x;
40 	// the height of the table
41 	pos_T table_size_y;
42 	// the starting depth for the search
43 	int start_depth;
44 	// the maximum depth for the search
45 	int max_depth;
46 	// the increment of the depth in every iteration
47 	int depth_increment;
48 	// if set, the ai will think in advance even when he has only one good move
49 	// prevents the ai from wasting thinking time in a competition environment
50 	bool force_thinking;
51 	// the amount of random seed added to the heuristic function in every standing
52 	heur_T heur_seed;
53 	// if set, the ai will print information on the standard output
54 	bool print_info;
55 	// limits the amount of following steps to be investigated from a standing
56 	unsigned int max_branch;
57 
58 	// interrupt class, returns true if time is over
59 	AiTimeOver* timeOver;
60 
61 	// current search depth limit
62 	int depth_limit;
63 
64 	// a new game has started
65 	void newGame();
66 	// the current player made a step
67 	void step(pos_T x, pos_T y);
68 	// the server made a step
69 	void stepServer(pos_T x, pos_T y);
70 	// undo last move
71 	void undo();
72 	// suggest a move for the current player
73 	Field think();
74 private:
75 	// the standing persisted across steps
76 	Standing rememberedStanding;
77 	// the game history for undo
78 	previous_standings_T previousStandings;
79 	// suggest a move for the current player from the opening book
80 	Field openingBook();
81 };
82 
83 #endif // BOVO_AI_IMPL_H
84