2 This file is part of SloppyGUI.
4 SloppyGUI is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 SloppyGUI is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with SloppyGUI. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef XBOARDENGINE_H
19 #define XBOARDENGINE_H
21 #include "chessengine.h"
25 * The XboardEngine class represents a chess engine which uses the Xboard
26 * chess engine communication protocol.
28 * Xboard's specifications: http://www.tim-mann.org/xboard/engine-intf.html
31 class XboardEngine
: public ChessEngine
37 * Creates a new XboardEngine object.
38 * @param ioDevice An open chess engine process or socket.
39 * @param chessboard A chessboard object for converting between the various move formats.
40 * @param parent The parent object.
42 XboardEngine(QIODevice
* ioDevice
, Chessboard
* chessboard
, QObject
* parent
= 0);
46 * Starts a new chess game.
47 * @param side The side (color) the engine should play as.
48 * @param fen The FEN string of the starting position.
50 virtual void newGame(Chessboard::ChessSide side
, const QString
& fen
);
53 * Tells the opponent's move to the engine.
54 * @param move A chess move which the opponent made.
56 virtual void sendOpponentsMove(const ChessMove
& move
) const;
59 * Tells the engine to start thinking of its next move.
64 * Sets the time control, eg. 40 moves in 2 min. with 1 sec. increment.
65 * @param timeControl The time control.
67 virtual void setTimeControl(TimeControl timeControl
);
70 * Tells the engine how much time it has left in the whole game.
71 * @param timeLeft Time left in milliseconds.
72 * @see setTimeControl()
74 virtual void setTimeLeft(int timeLeft
);
77 * Gets the chess protocol which the engine uses.
78 * @return The chess protocol, which is Xboard.
80 virtual ChessProtocol
protocol() const;
83 virtual void parseLine(const QString
& line
);