2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
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 2 of the License, or
8 (at your option) any later version.
11 #ifndef XBOARDENGINE_H
12 #define XBOARDENGINE_H
18 class IMoveSerializer
;
21 * @brief A chess engine compatible with xboard.
23 * XBoard compatible engines are defined by Tim Mann's
24 * Chess Engine Communication Protocol (available at
25 * http://tim-mann.org/xboard/engine-intf.html), used
26 * by GNU Chess, Crafty and many other free and commercial
28 * This class encapsulates such communication protocol,
29 * calling appropriate methods of the notifier upon engine
32 * @note This code is partially stolen from Maurizio Monge's
33 * old interface project outoftime.
35 class XBoardEngine
: public Engine
{
60 Components
* m_components
;
61 IMoveSerializer
* m_serializer
;
63 static QRegExp m_move_pattern
;
66 * Initialize the engine.
68 virtual void initializeEngine();
71 * Parse engine command line and the appropriate
74 void processCommand(const QString
& command
);
77 * Create an xboard compatible engine.
79 XBoardEngine(Components
* components
,
81 const QStringList
& arguments
);
84 * Terminate the engine.
86 virtual ~XBoardEngine();
89 * Send a move to the engine.
91 virtual void sendMove(const Move
& move
, const StatePtr
& ref
);
95 * @param pos The position before the move. Used if the engine
96 * does not support the undo command.
98 virtual void backUp(const StatePtr
& pos
);
100 virtual void setBoard(const StatePtr
& pos
);
106 virtual void reset();
118 virtual void startAnalysis();
119 virtual void stopAnalysis();
122 #endif // XBOARDENGINE_H