Use shared SVG renderers.
[sloppygui.git] / src / xboardengine.h
blobe79e304b89eaa427b30222d80ae13b5de3551f55
1 /*
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"
24 /**
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
29 * @see ChessEngine
31 class XboardEngine: public ChessEngine
33 Q_OBJECT
35 public:
36 /**
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);
43 ~XboardEngine();
45 /**
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);
52 /**
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;
58 /**
59 * Tells the engine to start thinking of its next move.
61 virtual void go();
63 /**
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);
69 /**
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);
76 /**
77 * Gets the chess protocol which the engine uses.
78 * @return The chess protocol, which is Xboard.
80 virtual ChessProtocol protocol() const;
82 protected:
83 virtual void parseLine(const QString& line);
86 #endif