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>
23 namespace TurnPolicy
{
26 * An abstract class encapsulating the user ability
27 * to move in a given turn.
29 class TAGUA_EXPORT Abstract
{
32 virtual bool check() const = 0;
36 * Premove policy. Used to check whether premoving is allowed.
37 * It is a <i>global</i> policy.
39 class TAGUA_EXPORT Premove
{
42 virtual bool check() const = 0;
45 class TAGUA_EXPORT Collection
{
46 typedef boost::shared_ptr
<Abstract
> PolicyPtr
;
47 typedef std::map
<const IColor
*, PolicyPtr
> Policies
;
48 typedef boost::shared_ptr
<Premove
> PremovePolicyPtr
;
51 PremovePolicyPtr m_premove
;
53 bool operator()(const IColor
* turn
) const;
54 void setPolicy(const IColor
* turn
, const PolicyPtr
& policy
);
55 void setSimplePolicy(const IColor
* turn
, bool value
);
58 void setPremovePolicy(const PremovePolicyPtr
& policy
);
63 typedef TurnPolicy::Collection TurnTest
;
65 #endif // TURNPOLICY_H