00001
00002
00003 #ifndef OSL_MOVE_GENERATOR_CAPTURE_H
00004 #define OSL_MOVE_GENERATOR_CAPTURE_H
00005
00006 #include "osl/state/numEffectState.h"
00007 #include "osl/move_action/concept.h"
00008 #include "osl/move_action/store.h"
00009 #include "osl/container/moveVector.h"
00010
00011 namespace osl
00012 {
00013 namespace move_generator
00014 {
00018 template<class Action>
00019 class Capture
00020 {
00021 BOOST_CLASS_REQUIRE(Action,osl::move_action,Concept);
00022 public:
00026 template<Player P>
00027 static void generate(const NumEffectState& state,Square target,
00028 Action& action);
00034 template<Player P>
00035 static void escapeByCapture(const NumEffectState& state,Square target,
00036 Piece piece,Action& action);
00041 template<Player P>
00042 static void generate1(const NumEffectState& state,Square target,
00043 Action& action);
00044 };
00045
00049 struct GenerateCapture
00050 {
00051 template<class Action>
00052 static void generate(Player p, const NumEffectState& state,Square target,
00053 Action& action)
00054 {
00055 if (p == BLACK)
00056 Capture<Action>::template generate<BLACK>(state,target,action);
00057 else
00058 Capture<Action>::template generate<WHITE>(state,target,action);
00059 }
00060 static void generate(Player P, const NumEffectState& state,Square target,
00061 MoveVector& out)
00062 {
00063 using move_action::Store;
00064 Store store(out);
00065 generate(P, state, target, store);
00066 }
00067 static void generate(const NumEffectState& state,Square target,
00068 MoveVector& out)
00069 {
00070 generate(state.turn(), state, target, out);
00071 }
00072 template<class Action>
00073 static void generate1(Player p, const NumEffectState& state,Square target,
00074 Action& action)
00075 {
00076 if (p == BLACK)
00077 Capture<Action>::template generate1<BLACK>(state,target,action);
00078 else
00079 Capture<Action>::template generate1<WHITE>(state,target,action);
00080 }
00081 static void generate1(Player P, const NumEffectState& state,Square target,
00082 MoveVector& out)
00083 {
00084 using move_action::Store;
00085 Store store(out);
00086 generate1(P, state, target, store);
00087 }
00088
00089 template<class Action>
00090 static void escapeByCapture(Player p, const NumEffectState& state,Square target,
00091 Piece piece,Action& action)
00092 {
00093 if (p == BLACK)
00094 Capture<Action>::template escapeByCapture<BLACK>(state,target,piece,action);
00095 else
00096 Capture<Action>::template escapeByCapture<WHITE>(state,target,piece,action);
00097 }
00098 };
00099
00100 }
00101 using move_generator::GenerateCapture;
00102 }
00103
00104
00105 #endif
00106
00107
00108
00109