7 if (state.turn() ==
BLACK)
8 return canDeclareWin<BLACK>(state);
10 return canDeclareWin<WHITE>(state);
13 template <osl::Player Turn>
18 assert(Turn == state.turn());
20 = state.kingSquare(Turn);
23 if ( state.hasEffectAt(
alt(Turn), myKingSquare) )
29 const int y = myKingSquare.
y();
30 const int enemyCampMin = (Turn==
BLACK) ? 1 : 7;
31 const int enemyCampMax = enemyCampMin + 2;
33 if( (y < enemyCampMin) || (y > enemyCampMax) )
42 for (
int i = enemyCampMin; i <= enemyCampMax; i++)
43 for (
int j=1; j<=9; j++){
44 Piece pieceOnEnemyCamp = state.pieceOnBoard(
Square(j,i));
47 onEnemyCamp += 1 + 4 *
isMajor(pieceOnEnemyCamp.
ptype());
55 5 * state.countPiecesOnStand<
ROOK>(Turn)
56 + 5 * state.countPiecesOnStand<
BISHOP>(Turn)
57 + state.countPiecesOnStand<
GOLD>(Turn)
58 + state.countPiecesOnStand<
SILVER>(Turn)
59 + state.countPiecesOnStand<
KNIGHT>(Turn)
60 + state.countPiecesOnStand<
LANCE>(Turn)
61 + state.countPiecesOnStand<
PAWN>(Turn);
63 if ( onEnemyCamp + onStand < 27 + (Turn==
BLACK) )
71 if (state.turn() ==
BLACK)
72 return canDeclareWin<BLACK>(state, distance);
74 return canDeclareWin<WHITE>(state, distance);
77 template <osl::Player Turn>
88 assert(Turn == state.turn());
90 = state.kingSquare(Turn);
94 if ( state.hasEffectAt(
alt(Turn), myKingSquare) )
100 const int y = myKingSquare.
y();
101 const int enemyCampMin = (Turn==
BLACK) ? 1 : 7;
102 const int enemyCampMax = enemyCampMin + 2;
104 if( (y < enemyCampMin) || (y > enemyCampMax) )
111 int onEnemyCamp = -1;
113 for (
int i = enemyCampMin; i <= enemyCampMax; i++)
114 for (
int j=1; j<=9; j++){
115 Piece pieceOnEnemyCamp = state.pieceOnBoard(
Square(j,i));
118 onEnemyCamp += 1 + 4 *
isMajor(pieceOnEnemyCamp.
ptype());
123 5 * state.countPiecesOnStand<
ROOK>(Turn)
124 + 5 * state.countPiecesOnStand<
BISHOP>(Turn)
125 + state.countPiecesOnStand<
GOLD>(Turn)
126 + state.countPiecesOnStand<
SILVER>(Turn)
127 + state.countPiecesOnStand<
KNIGHT>(Turn)
128 + state.countPiecesOnStand<
LANCE>(Turn)
129 + state.countPiecesOnStand<
PAWN>(Turn);
131 if ( onEnemyCamp + onStand < 27 + (Turn==
BLACK) )
134 if (countPiece < 11) {
135 drops = 11 - countPiece;
148 template bool osl::enter_king::EnterKing::canDeclareWin<BLACK>(
const NumEffectState&);
149 template bool osl::enter_king::EnterKing::canDeclareWin<WHITE>(
const NumEffectState&);
150 template bool osl::enter_king::EnterKing::canDeclareWin<BLACK>(
const NumEffectState&,
int &drops);
151 template bool osl::enter_king::EnterKing::canDeclareWin<WHITE>(
const NumEffectState&,
int &drops);