11   area_progresses[
BLACK]=makeProgressArea(
WHITE, state, state.kingSquare(
BLACK));
 
   12   area_progresses[
WHITE]=makeProgressArea(
BLACK, state, state.kingSquare(
WHITE));
 
   13   stand_progresses[
WHITE]=makeProgressStand(
BLACK, state);
 
   14   stand_progresses[
BLACK]=makeProgressStand(
WHITE, state);
 
   23   return makeProgressArea(
alt(defense), state, king) 
 
   24     + makeProgressStand(
alt(defense), state);
 
   33   const int min_x = center.
x() - 2;
 
   34   const int min_y = center.
y() - 1;
 
   39   for (
int dx=0; dx<5; ++dx)
 
   41       for (
int dy=0; dy<3; ++dy)
 
   44           sum_effect += state.countEffect(attack, target) *
 
   48   return sum_effect / 2;
 
   56   sum_pieces += state.countPiecesOnStand<
PAWN>(attack)*Effect5x3Table::StandPAWN;
 
   57   sum_pieces += state.countPiecesOnStand<
LANCE>(attack)*Effect5x3Table::StandLANCE;
 
   58   sum_pieces += state.countPiecesOnStand<
KNIGHT>(attack)*Effect5x3Table::StandKNIGHT;
 
   59   sum_pieces += state.countPiecesOnStand<
SILVER>(attack)*Effect5x3Table::StandSILVER;
 
   60   sum_pieces += state.countPiecesOnStand<
GOLD>(attack)*Effect5x3Table::StandGOLD;
 
   61   sum_pieces += state.countPiecesOnStand<
BISHOP>(attack)*Effect5x3Table::StandBISHOP;
 
   62   sum_pieces += state.countPiecesOnStand<
ROOK>(attack)*Effect5x3Table::StandROOK;
 
   85   updateStand(stand_progresses[
alt(pl)], last_move);
 
   87   const Square kb = new_state.kingSquare<
BLACK>(), kw = new_state.kingSquare<
WHITE>();
 
   88   BoardMask mb = new_state.changedEffects(
BLACK), mw = new_state.changedEffects(
WHITE);
 
   89   bool king_move = last_move.
ptype() == 
KING;
 
   91     area_progresses[
WHITE]=makeProgressArea(
BLACK,new_state, kw);
 
   93     area_progresses[
BLACK]=makeProgressArea(
WHITE,new_state, kb);
 
  105     int old = stand_progresses[alt_pl];
 
  124 template <osl::Player Defense>
 
  129     state.kingSquare<Defense>();
 
  133   const int min_x = center.x() - 2;
 
  134   const int min_y = center.y() - 1;
 
  137   for (
int dx = 0; dx < 5; ++dx)
 
  139     for (
int dy = 0; dy < 3; ++dy)
 
  142       mask = mask | state.effectSetAt(target);
 
  152   const int a = state.countEffect(attack, target);
 
  155   if (state.countEffect(
alt(attack), target) > 0
 
  156       || state.pieceAt(target).isOnBoardByOwner(attack))
 
  166     int countPawnLanceKnight(
const NumEffectState& state, 
Square target) 
 
  171       const Piece pd = state.pieceAt(d);
 
  181         if (state.hasLongEffectAt<
LANCE>(P, target))
 
  199 template <osl::Player Attack, 
bool AlwaysPromotable, 
bool AlwaysNotPromotable>
 
  204   const int min_x = center.
x() - 2;
 
  205   const int min_y = center.
y() - 1;
 
  210   for (
int dy = 0; dy < 3; ++dy)
 
  213     int effect = attackEffect3(state, Attack, target) * 2;
 
  216       if (! AlwaysPromotable
 
  217           && (AlwaysNotPromotable || !target.
canPromote<Attack>()) )
 
  219         effect -= countPawnLanceKnight<Attack>(state, 
target);
 
  222       sum_effect += effect *
 
  227   for (
int x = king.
x() - 1; x >= min_x; --x)
 
  231     for (
int dy = 0; dy < 3; ++dy)
 
  234       int effect = attackEffect3(state, Attack, target) * 2;
 
  237         if (! AlwaysPromotable
 
  238             && (AlwaysNotPromotable || !target.
canPromote<Attack>()) )
 
  240           if (king.
x() - x > 1)
 
  243             effect -= countPawnLanceKnight<Attack>(state, 
target);
 
  258   for (
int x = king.
x() + 1; x < min_x + 5; ++x)
 
  262     for (
int dy = 0; dy < 3; ++dy)
 
  265       int effect = attackEffect3(state, Attack, target) * 2;
 
  268         if (! AlwaysPromotable
 
  269             && (AlwaysNotPromotable || !target.
canPromote<Attack>()) )
 
  271           if (x - king.
x() > 1)
 
  274             effect -= countPawnLanceKnight<Attack>(state, 
target);
 
  289   return sum_effect / 2;
 
  292 template <osl::Player Attack>
 
  299   const bool always_promotable = center.
squareForBlack<Attack>().y() <= 2;
 
  300   if (always_promotable)
 
  301     return makeProgressAreaBonus<Attack,true,false>(state, king, 
center);
 
  302   const bool always_notpromotable = center.
squareForBlack<Attack>().y() >= 5;
 
  303   if (always_notpromotable)
 
  304     return makeProgressAreaBonus<Attack,false,true>(state, king, 
center);
 
  305   return makeProgressAreaBonus<Attack,false,false>(state, king, 
center);
 
  313   const Square kb = new_state.kingSquare<
BLACK>(), kw = new_state.kingSquare<
WHITE>();
 
  314   BoardMask mask = new_state.changedEffects();
 
  315   mask.set(last_move.
to()); mask.set(last_move.
from());
 
  322     progress_bonuses[
BLACK]=makeProgressAreaBonus<WHITE>(new_state,kb);
 
  323     effect_mask[
BLACK] = makeEffectMask<BLACK>(new_state);
 
  327     progress_bonuses[
WHITE]=makeProgressAreaBonus<BLACK>(new_state,kw);
 
  328     effect_mask[
WHITE] = makeEffectMask<WHITE>(new_state);
 
  330   updateProgressBonuses(new_state, update_black, update_white);
 
  349   if (update_black && progress_bonuses[
BLACK] != 0)
 
  351     const int pieces = countEffectPieces(state, 
WHITE);
 
  352     progress_bonuses[
BLACK] =
 
  354                progress_bonuses[
BLACK]);
 
  356   if (update_white && progress_bonuses[
WHITE] != 0)
 
  358     const int pieces = countEffectPieces(state, 
BLACK);
 
  359     progress_bonuses[
WHITE] =
 
  361                progress_bonuses[
WHITE]);
 
  368   PieceMask mask = effect5x3Mask(
alt(attack));
 
  369   mask = mask & state.piecesOnBoard(attack);
 
  370   return mask.countBit();