openKingRoad.h
Go to the documentation of this file.
00001 #ifndef _GENERATE_OPEN_KING_ROAD_H
00002 #define _GENERATE_OPEN_KING_ROAD_H
00003 #include "osl/move_generator/pieceOnBoard.h"
00004 
00005 namespace osl
00006 {
00007   namespace move_generator
00008   {
00012     template <Player P>
00013     struct OpenKingRoad
00014     {
00015       
00016       template <class Action>
00017       static void generateDir(const NumEffectState& state, Action& action, const Direction& dir)
00018       {
00019         Square pos = state.kingSquare<P>()
00020           + Board_Table.getOffset<P>(dir);
00021         if (pos.isEdge()) return;
00022 
00023         Piece piece = state.pieceOnBoard(pos);
00024         if (piece != Piece::EMPTY() && piece.owner() == P)
00025         {
00026           PieceOnBoard<Action>::template generate<P,false>(state, piece, action);
00027         }
00028       }
00029       
00030       template <class Action>
00031       static void generate(const NumEffectState& state, Action& action)
00032       {
00033         generateDir(state, action, UL);
00034         generateDir(state, action, U);
00035         generateDir(state, action, UR);
00036         generateDir(state, action, L);
00037         generateDir(state, action, R);
00038         generateDir(state, action, DL);
00039         generateDir(state, action, D);
00040         generateDir(state, action, DR);
00041       }
00042     };
00043   }
00044 } // namespace osl
00045 
00046 #endif /* _GENERATE_OPEN_KING_ROAD_H */
00047 // ;;; Local Variables:
00048 // ;;; mode:c++
00049 // ;;; c-basic-offset:2
00050 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines