Add more assertions.
[tagua/yd.git] / src / gnushogiengine.h
blob87bb48d1dc4b692fdf3e6d5b65496c55c894256b
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"
16 class Components;
17 class IMoveSerializer;
18 class QRegExp;
20 /**
21 * @brief A shogi engine compatible with gnushogi.
23 * @note This code is partially stolen from the XBoard engine class
25 class GNUShogiEngine : public Engine {
26 Q_OBJECT
27 struct Features {
28 bool ping : 1;
29 bool setboard : 1;
30 bool playother : 1;
31 bool san : 1;
32 bool usermove : 1;
33 bool time : 1;
34 bool draw : 1;
35 bool sigint : 1;
36 bool sigterm : 1;
37 bool reuse : 1;
38 bool analyze : 1;
39 QString myname;
40 QString variants;
41 bool colors : 1;
42 bool ics : 1;
43 bool name : 1;
44 bool pause : 1;
45 bool done : 1;
48 Features m_features;
49 bool m_analysing;
50 IMoveSerializer* m_serializer;
52 static QRegExp m_move_pattern;
53 protected:
54 /**
55 * Initialize the engine.
57 virtual void initializeEngine();
58 protected Q_SLOTS:
59 /**
60 * Parse engine command line and the appropriate
61 * signals.
63 void processCommand(const QString& command);
64 public:
65 /**
66 * Create an gnushogi compatible engine.
68 GNUShogiEngine(Components* components,
69 const QString& path,
70 const QStringList& arguments);
72 /**
73 * Terminate the engine.
75 virtual ~GNUShogiEngine();
77 /**
78 * Send a move to the engine.
80 virtual void sendMove(const Move& move, const StatePtr& ref);
82 /**
83 * Back up a move.
84 * @param pos The position before the move. Used if the engine
85 * does not support the undo command.
87 virtual void backUp(const StatePtr& pos);
89 virtual void setBoard(const StatePtr& pos);
92 /**
93 * Begin a new game.
95 virtual void reset();
97 /**
98 * Start playing.
100 virtual void play();
103 * Stop the engine.
105 virtual void stop();
107 virtual void startAnalysis();
108 virtual void stopAnalysis();
111 #endif // GNUSHOGIENGINE_H