00001 #ifndef _GENERATE_ALL_MOVES_H
00002 #define _GENERATE_ALL_MOVES_H
00003 #include "osl/misc/loki.h"
00004 #include "osl/player.h"
00005 #include "osl/ptype.h"
00006 #include "osl/position.h"
00007 #include "osl/direction.h"
00008 #include "osl/piece.h"
00009 #include "osl/move_action/concept.h"
00010 #include "osl/container/bitXmask.h"
00011 #include <boost/static_assert.hpp>
00012
00013
00014
00015
00016 namespace osl
00017 {
00018 namespace container
00019 {
00020 class MoveVector;
00021 }
00022 namespace move_generator
00023 {
00029 template<class State,class Action>
00030 class AllMoves
00031 {
00032 BOOST_CLASS_REQUIRE(Action,osl::move_action,Concept);
00033 BOOST_STATIC_ASSERT(sizeof(typename State::simple_board_t));
00034 public:
00035 template<Player P,Ptype Type>
00036 static void generateMovesPtype(const State& state, Action& action);
00037
00043 template<Player P>
00044 static void generateMovesPawn(const State& state, Action& action,BitXmask& pawnMask);
00045
00046 template<Player P>
00047 static void generateMoves(const State& state, Action& action);
00048
00049 template<Player P>
00050 static void generateMoves(const State& state, Action& action,Int2Type<true> stateHasPawnMask);
00051 template<Player P>
00052 static void generateMoves(const State& state, Action& action,Int2Type<false> stateHasPawnMask);
00053
00054
00055 static void generateMoves(Player p, const State& state, Action& action)
00056 {
00057 if(p==BLACK)
00058 generateMoves<BLACK>(state,action);
00059 else
00060 generateMoves<WHITE>(state,action);
00061 }
00062 };
00063
00064 }
00065
00066 struct GenerateAllMoves
00067 {
00068 template <class State>
00069 static void generate(Player p, const State& state, container::MoveVector&);
00070 };
00071 }
00072
00073 #endif
00074
00075
00076
00077