00001
00002
00003 #ifndef _MOVE_ACTION_NOT_KING_OPEN_FILTER_H
00004 #define _MOVE_ACTION_NOT_KING_OPEN_FILTER_H
00005 #include "osl/position.h"
00006 #include "osl/player.h"
00007 #include "osl/ptype.h"
00008 #include "osl/move_action/concept.h"
00009 #include "osl/move_classifier/kingOpenMove.h"
00010
00011 namespace osl
00012 {
00013 namespace move_action
00014 {
00015
00019 template<Player P,class State,class OrigAction>
00020 struct NotKingOpenFilter
00021 {
00022 BOOST_CLASS_REQUIRE(OrigAction,osl::move_action,Concept);
00023 const State& state;
00024 OrigAction & action;
00025 public:
00026 NotKingOpenFilter(const State& s, OrigAction & action)
00027 : state(s), action(action) {
00028 }
00029 bool isNotKingOpenMove(Ptype ptype,Position from,Position to)
00030 {
00031 return !move_classifier::KingOpenMove<P>::isMember(state, ptype, from, to);
00032 }
00033 void simpleMove(Position from,Position to,Ptype ptype, bool isPromote,Player
00034 #ifndef NDEBUG
00035 p
00036 #endif
00037 ){
00038 assert(p == P);
00039 if(isNotKingOpenMove(ptype,from,to))
00040 action.simpleMove(from,to,ptype,isPromote,P);
00041
00042 }
00043 void unknownMove(Position from,Position to,Piece p1,Ptype ptype,bool isPromote,Player
00044 #ifndef NDEBUG
00045 p
00046 #endif
00047 ){
00048 assert(p == P);
00049 if(isNotKingOpenMove(ptype,from,to))
00050 action.unknownMove(from,to,p1,ptype,isPromote,P);
00051 }
00055 void dropMove(Position to,Ptype ptype,Player
00056 #ifndef NDEBUG
00057 p
00058 #endif
00059 ){
00060 assert(p == P);
00061 action.dropMove(to,ptype,P);
00062 }
00063 };
00064 }
00065 }
00066
00067 #endif
00068
00069
00070
00071