promote_.h
Go to the documentation of this file.
00001 #ifndef OSL_MOVE_GENERATOR_PROMOTE_H
00002 #define OSL_MOVE_GENERATOR_PROMOTE_H
00003 #include "osl/state/numEffectState.h"
00004 #include "osl/move_action/concept.h"
00005 #include "osl/move_action/store.h"
00006 #include "osl/container/moveVector.h"
00007 namespace osl
00008 {
00009   namespace move_generator
00010   {
00017     template<Player P,bool NoCapture=true>
00018     class Promote
00019     {
00020     public:
00021       template<class Action, Ptype T>
00022       static void generateMovesPtype(const NumEffectState& state, Action& action);
00023       template<Ptype T>
00024       static void generatePtype(const NumEffectState& state, MoveVector& out)
00025       {
00026         move_action::Store store(out);
00027         generateMovesPtype<move_action::Store,T>(state, store);
00028       }
00029       template<class Action>
00030       static void generateMoves(const NumEffectState& state, Action& action);
00031 
00032       static void generate(const NumEffectState& state, MoveVector& out)
00033       {
00034         move_action::Store store(out);
00035         generateMoves(state, store);
00036       }
00037     };
00038 
00042     template<bool NoCapture>
00043     struct GeneratePromote
00044     {
00045       template<class Action>
00046       static void generate(Player p, const NumEffectState& state, Action& action)
00047       {
00048         if (p == BLACK)
00049           Promote<BLACK,NoCapture>::generateMoves(state, action);
00050         else
00051           Promote<WHITE,NoCapture>::generateMoves(state, action);
00052       }
00053     };
00054   }
00055 }
00056 #endif /* OSL_MOVE_GENERATOR_PROMOTE_H */
00057 // ;;; Local Variables:
00058 // ;;; mode:c++
00059 // ;;; c-basic-offset:2
00060 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines