2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
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.
15 #include <boost/shared_ptr.hpp>
18 namespace TurnPolicy
{
21 * An abstract class encapsulating the user ability
22 * to move in a given turn.
27 virtual bool check() const = 0;
31 * Premove policy. Used to check whether premoving is allowed.
32 * It is a <i>global</i> policy.
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
;
46 PremovePolicyPtr m_premove
;
48 bool operator()(int turn
) const;
49 void setPolicy(int turn
, const PolicyPtr
& policy
);
50 void setSimplePolicy(int turn
, bool value
);
53 void setPremovePolicy(const PremovePolicyPtr
& policy
);
58 typedef TurnPolicy::Collection TurnTest
;
60 #endif // TURNPOLICY_H