Subversion Repositories Games.Chess Giants

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
99 pmbaty 1
/*
2
    Texel - A UCI chess engine.
3
    Copyright (C) 2012  Peter Ă–sterlund, peterosterlund2@gmail.com
4
 
5
    This program 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 3 of the License, or
8
    (at your option) any later version.
9
 
10
    This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18
 
19
/*
20
 * player.hpp
21
 *
22
 *  Created on: Feb 25, 2012
23
 *      Author: petero
24
 */
25
 
26
#ifndef PLAYER_HPP_
27
#define PLAYER_HPP_
28
 
29
#include <vector>
30
#include <string>
31
 
32
class Position;
33
 
34
/**
35
 * Interface for human/computer players.
36
 */
37
class Player {
38
public:
39
    virtual ~Player();
40
 
41
    /**
42
     * Get a command from a player.
43
     * The command can be a valid move string, in which case the move is played
44
     * and the turn goes over to the other player. The command can also be a special
45
     * command, such as "quit", "new", "resign", etc.
46
     * @param history List of earlier positions (not including the current position).
47
     *                This makes it possible for the player to correctly handle
48
     *                the draw by repetition rule.
49
     */
50
    virtual std::string getCommand(const Position& pos, bool drawOffer,
51
                                   const std::vector<Position>& history) = 0;
52
 
53
    /** Return true if this player is a human player. */
54
    virtual bool isHumanPlayer() = 0;
55
 
56
    /**
57
     * Inform player whether or not to use an opening book.
58
     * Of course, a human player is likely to ignore this.
59
     */
60
    virtual void useBook(bool bookOn) = 0;
61
 
62
    /**
63
     * Inform player about min recommended/max allowed thinking time per move.
64
     * Of course, a human player is likely to ignore this.
65
     */
66
    virtual void timeLimit(int minTimeLimit, int maxTimeLimit) = 0;
67
 
68
    /**
69
     * Inform player that the transposition table should be cleared.
70
     * Of course, a human player has a hard time implementing this.
71
     */
72
    virtual void clearTT() = 0;
73
};
74
 
75
inline
76
Player::~Player() {
77
}
78
 
79
 
80
#endif /* PLAYER_HPP_ */