Removed AlgebraicNotation from the variant API.
[tagua/yd.git] / src / turnpolicy.h
blobfeaa2081d5e6e0cea44e8558be54791e8c24f4f7
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2007 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 TURNPOLICY_H
12 #define TURNPOLICY_H
14 #include <map>
15 #include <boost/shared_ptr.hpp>
16 #include "export.h"
18 namespace TurnPolicy {
20 /**
21 * An abstract class encapsulating the user ability
22 * to move in a given turn.
24 class Abstract {
25 public:
26 virtual ~Abstract();
27 virtual bool check() const = 0;
30 /**
31 * Premove policy. Used to check whether premoving is allowed.
32 * It is a <i>global</i> policy.
34 class Premove {
35 public:
36 virtual ~Premove();
37 virtual bool check() const = 0;
40 class TAGUA_EXPORT Collection {
41 typedef boost::shared_ptr<Abstract> PolicyPtr;
42 typedef std::map<int, PolicyPtr> Policies;
43 typedef boost::shared_ptr<Premove> PremovePolicyPtr;
44 Policies m_policies;
46 PremovePolicyPtr m_premove;
47 public:
48 bool operator()(int turn) const;
49 void setPolicy(int turn, const PolicyPtr& policy);
50 void setSimplePolicy(int turn, bool value);
51 void clear();
53 void setPremovePolicy(const PremovePolicyPtr& policy);
54 bool premove() const;
58 typedef TurnPolicy::Collection TurnTest;
60 #endif // TURNPOLICY_H