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);
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);
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);
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);
static int attackEffect3(const NumEffectState &state, Player attack, Square target)
const BoardMaskTable5x3Center Board_Mask_Table5x3_Center
static int makeProgressAll(Player defense, const NumEffectState &state, Square king)
Ptype unpromote(Ptype ptype)
ptypeがpromote後の型の時に,promote前の型を返す. promoteしていない型の時はそのまま返す ...
int countEffect(Player player, Square target) const
利きの数を数える.
bool isOnBoardByOwner() const
piece がプレイヤーPの持ち物でかつボード上にある駒の場合は true.
bool hasLongEffectAt(Player P, Square to) const
あるマスにPTYPEの長い利きがあるかどうか.
Effect5x3WithBonus expect(const NumEffectState &state, Move move) const
CArray< PieceMask, 2 > effect_mask
const BoardMask changedEffects(Player pl) const
const PieceMask effect5x3Mask(Player p) const
constexpr Player alt(Player player)
unsigned int piecesOnStand(Ptype ptype) const
持駒のPtypeごとの寄与を表すテーブルの参照.
static const Square adjustCenter(Square src)
int min(Player p, int v1, int v2)
int countPiecesOnStand(Player pl, Ptype ptype) const
持駒の枚数を数える
const BoardMask & mask(Square p) const
p中心の5x3 の範囲のbitを立てたもの, centering
const Piece pieceAt(Square sq) const
static int makeProgressAreaBonus(const NumEffectState &state, Square king)
int y() const
将棋としてのY座標を返す.
Effect5x3(const NumEffectState &state)
int x() const
将棋としてのX座標を返す.
PtypeO newPtypeO(Player player, Ptype ptype)
Square kingSquare() const
Effect5x3WithBonus(const NumEffectState &state)
void update(const NumEffectState &new_state, Move last_move)
const Square from() const
static void updateStand(int &old_stand, Move last_move)
const NumBitmapEffect effectSetAt(Square sq) const
unsigned int getAttackEffect(Player pl, Square pos, int x, int y) const
void update(const NumEffectState &new_state, Move last_move)
constexpr int playerToIndex(Player player)
static int makeProgressStand(Player attack, const NumEffectState &state)
void updateStand(Player pl, Move m)
Ptype capturePtype() const
int countEffectPieces(const NumEffectState &state, Player attack) const
const PieceMask & piecesOnBoard(Player p) const
static PieceMask makeEffectMask(const NumEffectState &state)
Effect5x3 expect(const NumEffectState &state, Move move) const
bool anyInRange(const BoardMask &mask) const
CArray< int, 2 > progress_bonuses
Effect5x3Table Effect5x3_Table
const Square squareForBlack(Player player) const
玉の周囲5x3の領域の利きの数と持駒から計算した進行度.
CArray< int, 2 > progresses
static int makeProgressArea(Player attack, const NumEffectState &state, Square king)
CArray< int, 2 > stand_progresses
void updateProgressBonuses(const NumEffectState &state, bool black=true, bool white=true)