Go to the documentation of this file.00001 #ifndef OSL_GENERATE_ALL_MOVES_H
00002 #define OSL_GENERATE_ALL_MOVES_H
00003 #include "osl/state/numEffectState.h"
00004 #include "osl/misc/loki.h"
00005 #include "osl/move_action/store.h"
00006 #include "osl/move_action/concept.h"
00007 #include "osl/container/moveVector.h"
00008 #include <boost/static_assert.hpp>
00009
00010 namespace osl
00011 {
00012 namespace container
00013 {
00014 class MoveVector;
00015 }
00016 namespace move_generator
00017 {
00022 template<class Action>
00023 class AllMoves
00024 {
00025 BOOST_CLASS_REQUIRE(Action,osl::move_action,Concept);
00026 public:
00032 template<Player P>
00033 static void generateOnBoard(const NumEffectState& state, Action& action);
00034
00040 template<Player P>
00041 static void generate(const NumEffectState& state, Action& action);
00042
00043 static void generate(Player p, const NumEffectState& state, Action& action)
00044 {
00045 if(p==BLACK)
00046 generate<BLACK>(state,action);
00047 else
00048 generate<WHITE>(state,action);
00049 }
00050 };
00051
00052 }
00053
00054 struct GenerateAllMoves
00055 {
00056 static void generate(Player p, const NumEffectState& state, container::MoveVector&);
00057 template <Player P>
00058 static void generate(const NumEffectState& state, MoveVector& out)
00059 {
00060 typedef move_action::Store store_t;
00061 store_t store(out);
00062 move_generator::AllMoves<store_t>::generate<P>(state, store);
00063 }
00064 template <Player P>
00065 static void generateOnBoard(const NumEffectState& state, MoveVector& out)
00066 {
00067 typedef move_action::Store store_t;
00068 store_t store(out);
00069 move_generator::AllMoves<store_t>::generateOnBoard<P>(state, store);
00070 }
00071 };
00072 }
00073
00074 #endif
00075
00076
00077
00078