00001
00002
00003 #ifndef OSL_MOVE_GENERATOR_CAPTURE_H
00004 #define OSL_MOVE_GENERATOR_CAPTURE_H
00005
00006 #include "osl/move_generator/move_action.h"
00007 #include "osl/numEffectState.h"
00008
00009 namespace osl
00010 {
00011 namespace move_generator
00012 {
00016 template<class Action>
00017 class Capture
00018 {
00019 public:
00023 template<Player P>
00024 static void generate(const NumEffectState& state,Square target,
00025 Action& action);
00031 template<Player P>
00032 static void escapeByCapture(const NumEffectState& state,Square target,
00033 Piece piece,Action& action);
00038 template<Player P>
00039 static void generate1(const NumEffectState& state,Square target,
00040 Action& action);
00041 };
00042
00046 struct GenerateCapture
00047 {
00048 template<class Action>
00049 static void generate(Player p, const NumEffectState& state,Square target,
00050 Action& action)
00051 {
00052 if (p == BLACK)
00053 Capture<Action>::template generate<BLACK>(state,target,action);
00054 else
00055 Capture<Action>::template generate<WHITE>(state,target,action);
00056 }
00057 static void generate(Player P, const NumEffectState& state,Square target,
00058 MoveVector& out)
00059 {
00060 using move_action::Store;
00061 Store store(out);
00062 generate(P, state, target, store);
00063 }
00064 static void generate(const NumEffectState& state,Square target,
00065 MoveVector& out)
00066 {
00067 generate(state.turn(), state, target, out);
00068 }
00069 template<class Action>
00070 static void generate1(Player p, const NumEffectState& state,Square target,
00071 Action& action)
00072 {
00073 if (p == BLACK)
00074 Capture<Action>::template generate1<BLACK>(state,target,action);
00075 else
00076 Capture<Action>::template generate1<WHITE>(state,target,action);
00077 }
00078 static void generate1(Player P, const NumEffectState& state,Square target,
00079 MoveVector& out)
00080 {
00081 using move_action::Store;
00082 Store store(out);
00083 generate1(P, state, target, store);
00084 }
00085
00086 template<class Action>
00087 static void escapeByCapture(Player p, const NumEffectState& state,Square target,
00088 Piece piece,Action& action)
00089 {
00090 if (p == BLACK)
00091 Capture<Action>::template escapeByCapture<BLACK>(state,target,piece,action);
00092 else
00093 Capture<Action>::template escapeByCapture<WHITE>(state,target,piece,action);
00094 }
00095 };
00096
00097 }
00098 using move_generator::GenerateCapture;
00099 }
00100
00101
00102 #endif
00103
00104
00105
00106