allMoves.tcc
Go to the documentation of this file.
00001 #ifndef OSL_GENERATE_ALL_MOVES_TCC
00002 #define OSL_GENERATE_ALL_MOVES_TCC
00003 #include "osl/move_generator/allMoves.h"
00004 #include "osl/move_generator/pieceOnBoard.h"
00005 #include "osl/move_generator/pieceOnBoard.tcc"
00006 #include "osl/move_generator/drop.h"
00007 #include "osl/move_action/concept.h"
00008 #include "osl/move_action/store.h"
00009 #include "osl/state/numEffectState.h"
00010 
00011 namespace osl
00012 {
00013   namespace move_generator
00014   {
00015     namespace all_moves
00016     {
00017       template<class Action,Player P,Ptype T>
00018       void
00019       generatePtype(const NumEffectState& state, Action& action){
00020         for(int num=PtypeTraits<T>::indexMin;num<PtypeTraits<T>::indexLimit;++num){
00021           Piece p=state.pieceOf(num);
00022           if(p.isOnBoardByOwner<P>()){
00023             int dummy=0;
00024             if(PtypeTraits<T>::canPromote && p.isPromoted()){
00025               const Ptype PT=PtypeTraits<PtypeFuns<T>::promotePtype >::moveType;
00026               PieceOnBoard<Action>::template generatePtype<P,PT,false>(state,p,action,dummy);
00027             }
00028             else{
00029               PieceOnBoard<Action>::template generatePtype<P,T,false>
00030                 (state,p,action,dummy);
00031             }
00032           }
00033         }
00034       }
00035     }
00036     using all_moves::generatePtype;
00040     template<class Action>
00041     template<Player P>
00042     void AllMoves<Action>::
00043     generateOnBoard(const NumEffectState& state, Action& action){
00044       generatePtype<Action,P,PAWN>(state,action);
00045       generatePtype<Action,P,LANCE>(state,action);
00046       generatePtype<Action,P,KNIGHT>(state,action);
00047       generatePtype<Action,P,SILVER>(state,action);
00048       generatePtype<Action,P,GOLD>(state,action);
00049       generatePtype<Action,P,BISHOP>(state,action);
00050       generatePtype<Action,P,ROOK>(state,action);
00051       int dummy=0;
00052       PieceOnBoard<Action>::template generatePtype<P,KING,false>
00053         (state,state.kingPiece<P>(),action,dummy);
00054     }
00058     template<class Action>
00059     template<Player P>
00060     void AllMoves<Action>::
00061     generate(const NumEffectState& state, Action& action){
00062       generateOnBoard<P>(state,action);
00063       Drop<Action>::template generate<P>(state,action);
00064     }
00065 
00066 
00067   } // namespace move_generator
00068 } // namespace osl
00069 
00070 #endif /* OSL_GENERATE_ALL_MOVES_TCC */
00071 // ;;; Local Variables:
00072 // ;;; mode:c++
00073 // ;;; c-basic-offset:2
00074 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines