Tentative MiniShogi implementation over move generator.
[tagua/yd.git] / src / variants / minishogi / behaviour.h
blobcdcaf8bfb4f8d2f5c5d55fae32bb17a3ecbe1498
1 /*
2 Copyright (c) 2008 Yann Dirson <ydirson@altern.org>
4 This program 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 2 of the License, or
7 (at your option) any later version.
8 */
10 #ifndef MINISHOGI__BEHAVIOUR_H
11 #define MINISHOGI__BEHAVIOUR_H
13 #include <core/delegators/behaviour.h>
14 #include <core/promotionmanager.h>
16 class Move;
18 namespace MiniShogi {
20 class TAGUA_EXPORT Behaviour : public Delegators::Behaviour {
21 Q_OBJECT
22 Behaviour* m_delegator;
23 public:
24 Behaviour(IBehaviour* behaviour);
26 public Q_SLOTS: // delegated
27 void setPromotionManager(PromotionManager* pm) {
28 Q_ASSERT(QMetaObject::invokeMethod(m_dgate_behaviour, "setPromotionManager",
29 Q_ARG(PromotionManager*, pm)));
32 const PromotionManager* promotionManager() const {
33 const PromotionManager* result;
34 Q_ASSERT(QMetaObject::invokeMethod(m_dgate_behaviour, "promotionManager",
35 Q_RETURN_ARG(const PromotionManager*, result)));
36 return result;
39 bool mayPromote(const IState* state, const Move& move) const {
40 bool result;
41 Q_ASSERT(QMetaObject::invokeMethod(m_dgate_behaviour, "mayPromote",
42 Q_RETURN_ARG(bool, result),
43 Q_ARG(const IState*, state),
44 Q_ARG(const Move, move)));
45 return result;
48 public Q_SLOTS: // overridden
49 unsigned promotionZoneWidth() const { return 1; }
52 } // namespace MiniShogi
54 #endif // MINISHOGI__BEHAVIOUR_H