11 stand_progresses[
WHITE]=makeProgressStand(
BLACK, state);
12 stand_progresses[
BLACK]=makeProgressStand(
WHITE, state);
21 return makeProgressArea(
alt(defense), state, king)
22 + makeProgressStand(
alt(defense), state);
29 const Square center = Centering5x3::adjustCenter(king);
31 const int min_x = center.
x() - 2;
32 const int min_y = center.
y() - 1;
37 for (
int dx=0; dx<5; ++dx)
39 for (
int dy=0; dy<3; ++dy)
41 const Square target(min_x+dx,min_y+dy);
46 return sum_effect / 2;
83 updateStand(stand_progresses[
alt(pl)], last_move);
87 bool king_move = last_move.
ptype() ==
KING;
89 area_progresses[
WHITE]=makeProgressArea(
BLACK,new_state, kw);
91 area_progresses[
BLACK]=makeProgressArea(
WHITE,new_state, kb);
103 int old = stand_progresses[alt_pl];
122 template <osl::Player Defense>
131 const int min_x = center.x() - 2;
132 const int min_y = center.y() - 1;
135 for (
int dx = 0; dx < 5; ++dx)
137 for (
int dy = 0; dy < 3; ++dy)
139 const Square target(min_x+dx, min_y+dy);
197 template <osl::Player Attack,
bool AlwaysPromotable,
bool AlwaysNotPromotable>
202 const int min_x = center.
x() - 2;
203 const int min_y = center.
y() - 1;
208 for (
int dy = 0; dy < 3; ++dy)
210 const Square target(king.
x(), min_y + dy);
211 int effect = attackEffect3(state, Attack, target) * 2;
214 if (! AlwaysPromotable
215 && (AlwaysNotPromotable || !target.
canPromote<Attack>()) )
217 effect -= countPawnLanceKnight<Attack>(state, target);
220 sum_effect += effect *
225 for (
int x = king.
x() - 1; x >= min_x; --x)
229 for (
int dy = 0; dy < 3; ++dy)
231 const Square target(x, min_y + dy);
232 int effect = attackEffect3(state, Attack, target) * 2;
235 if (! AlwaysPromotable
236 && (AlwaysNotPromotable || !target.
canPromote<Attack>()) )
238 if (king.
x() - x > 1)
241 effect -= countPawnLanceKnight<Attack>(state, target);
256 for (
int x = king.
x() + 1; x < min_x + 5; ++x)
260 for (
int dy = 0; dy < 3; ++dy)
262 const Square target(x, min_y + dy);
263 int effect = attackEffect3(state, Attack, target) * 2;
266 if (! AlwaysPromotable
267 && (AlwaysNotPromotable || !target.
canPromote<Attack>()) )
269 if (x - king.
x() > 1)
272 effect -= countPawnLanceKnight<Attack>(state, target);
287 return sum_effect / 2;
290 template <osl::Player Attack>
297 const bool always_promotable = center.
squareForBlack<Attack>().y() <= 2;
298 if (always_promotable)
299 return makeProgressAreaBonus<Attack,true,false>(state, king, center);
300 const bool always_notpromotable = center.
squareForBlack<Attack>().y() >= 5;
301 if (always_notpromotable)
302 return makeProgressAreaBonus<Attack,false,true>(state, king, center);
303 return makeProgressAreaBonus<Attack,false,false>(state, king, center);
320 progress_bonuses[
BLACK]=makeProgressAreaBonus<WHITE>(new_state,kb);
321 effect_mask[
BLACK] = makeEffectMask<BLACK>(new_state);
325 progress_bonuses[
WHITE]=makeProgressAreaBonus<BLACK>(new_state,kw);
326 effect_mask[
WHITE] = makeEffectMask<WHITE>(new_state);
328 updateProgressBonuses(new_state, update_black, update_white);
347 if (update_black && progress_bonuses[
BLACK] != 0)
349 const int pieces = countEffectPieces(state,
WHITE);
350 progress_bonuses[
BLACK] =
352 progress_bonuses[
BLACK]);
354 if (update_white && progress_bonuses[
WHITE] != 0)
356 const int pieces = countEffectPieces(state,
BLACK);
357 progress_bonuses[
WHITE] =
359 progress_bonuses[
WHITE]);