Prepare 1.0 alpha3 release.
[tagua/yd.git] / src / gnushogiengine.h
blob242f4465a91f687284cb544728afe545734f2991
1 /*
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.
9 */
11 #ifndef GNUSHOGIENGINE_H
12 #define GNUSHOGIENGINE_H
14 #include "engine.h"
15 #include "tagua.h"
17 class QRegExp;
19 /**
20 * @brief A shogi engine compatible with gnushogi.
22 * @note This code is partially stolen from the XBoard engine class
24 class GNUShogiEngine : public Engine {
25 Q_OBJECT
26 struct Features {
27 bool ping : 1;
28 bool setboard : 1;
29 bool playother : 1;
30 bool san : 1;
31 bool usermove : 1;
32 bool time : 1;
33 bool draw : 1;
34 bool sigint : 1;
35 bool sigterm : 1;
36 bool reuse : 1;
37 bool analyze : 1;
38 QString myname;
39 QString variants;
40 bool colors : 1;
41 bool ics : 1;
42 bool name : 1;
43 bool pause : 1;
44 bool done : 1;
47 Features m_features;
48 bool m_analysing;
50 static QRegExp m_move_pattern;
51 protected:
52 /**
53 * Initialize the engine.
55 virtual void initializeEngine();
56 protected Q_SLOTS:
57 /**
58 * Parse engine command line and the appropriate
59 * signals.
61 void processCommand(const QString& command);
62 public:
63 /**
64 * Create an gnushogi compatible engine.
66 GNUShogiEngine(const QString& path, const QStringList& arguments);
68 /**
69 * Terminate the engine.
71 virtual ~GNUShogiEngine();
73 /**
74 * Send a move to the engine.
76 virtual void sendMove(AbstractMove::Ptr move, AbstractPosition::Ptr ref);
78 /**
79 * Back up a move.
80 * @param pos The position before the move. Used if the engine
81 * does not support the undo command.
83 virtual void backUp(AbstractPosition::Ptr pos);
85 virtual void setBoard(AbstractPosition::Ptr pos, int halfmove, int fullmove);
88 /**
89 * Begin a new game.
91 virtual void reset();
93 /**
94 * Start playing.
96 virtual void play();
98 /**
99 * Stop the engine.
101 virtual void stop();
103 virtual void startAnalysis();
104 virtual void stopAnalysis();
107 #endif // GNUSHOGIENGINE_H