3 #ifndef MOBILITY_BISHOP_MOBILITY_H
4 #define MOBILITY_BISHOP_MOBILITY_H
45 static int countAll(
const NumEffectState& state,
int num){
46 const Square posUL=state.mobilityOf(
UL,num);
47 const Square posUR=state.mobilityOf(
UR,num);
48 const Square posDL=state.mobilityOf(
DL,num);
49 const Square posDR=state.mobilityOf(
DR,num);
51 posDL.
y()-posUR.
y()-4+
52 (state.pieceAt(posUR).template canMoveOn<P>() ? 1 : 0)+
53 (state.pieceAt(posDR).template canMoveOn<P>() ? 1 : 0)+
54 (state.pieceAt(posUL).template canMoveOn<P>() ? 1 : 0)+
55 (state.pieceAt(posDL).template canMoveOn<P>() ? 1 : 0);
63 return countAll<P>(state,p.
number());
67 return countAll<BLACK>(state,p);
69 return countAll<WHITE>(state,p);
72 template<Player P, Direction Dir>
77 assert(Dir ==
UL || Dir ==
UR || Dir ==
DL || Dir ==
DR);
81 - 1 + (state.pieceAt(pos).template canMoveOn<P>() ? 1 : 0);
84 template <Direction dir>
87 return countAllDir<BLACK, dir>(state,p);
89 return countAllDir<WHITE, dir>(state,p);
108 return countSafe<BLACK>(state,p);
110 return countSafe<WHITE>(state,p);