16 for (
int x=1; x<=9; ++x) {
17 for (
int y=1; y<=9; ++y) {
18 const Square position(x,y);
43 std::pair<Ptype,Ptype> pair;
48 cache[cur++] = basic + pair.first;
49 cache[cur++] = basic +
AttackBase + pair.second;
60 int op_king_distance = abs(kings[
alt(turn)].x()-position.
x())
61 + abs(kings[
alt(turn)].y()-position.
y());
62 if (op_king_distance == 0)
67 cache[cur++] = basic +
OpKingBase + op_king_distance;
68 int my_king_distance = abs(kings[turn].x()-position.
x())
69 + abs(kings[turn].y()-position.
y());
70 if (my_king_distance == 0)
75 cache[cur++] = basic +
MyKingBase + my_king_distance;
91 for (
int i=1; i<4; ++i) {
117 i<PtypeTraits<LANCE>::indexLimit; ++i) {
122 makeLongAttackOne(info, p, d);
125 i<PtypeTraits<BISHOP>::indexLimit; ++i) {
129 makeLongAttackOne(info, p,
UL);
130 makeLongAttackOne(info, p,
UR);
131 makeLongAttackOne(info, p,
DL);
132 makeLongAttackOne(info, p,
DR);
135 i<PtypeTraits<ROOK>::indexLimit; ++i) {
139 makeLongAttackOne(info, p,
L);
140 makeLongAttackOne(info, p,
R);
141 makeLongAttackOne(info, p,
U);
142 makeLongAttackOne(info, p,
D);
157 Square attack_to2 = attack_to;
158 assert(! attack_to.isPieceStand());
159 if (attack_to.isEdge())
174 attacked =
alt(attacked);
175 int index = (longAttackIndex(attacking)*
PTYPEO_SIZE 178 if (attack_to.isNeighboring8(state.
kingSquare(turn)))
182 if (attack_to.canPromote(
alt(turn)))
195 if (threat_at == attack_to
198 piece.
square(), attack_to)))
const Move lastMove(size_t last=1) const
void push_back(const T &e)
static void updateCache(StateInfo &info)
bool isOnBoardByOwner() const
piece がプレイヤーPの持ち物でかつボード上にある駒の場合は true.
BoardMask changed_effects
bool hasEffectAt(Square target) const
対象とするマスにあるプレイヤーの利きがあるかどうか.
PieceMask pinOrOpen(Player king) const
PtypeO altIfPiece(PtypeO ptypeO)
Pieceの時にはowner を反転する
constexpr Player alt(Player player)
static void supportAttack(const NumEffectState &state, Square to, const PieceMask &my_pin, const PieceMask &op_pin, Player turn, std::pair< Ptype, Ptype > &out)
const MoveStack * history
CArray2d< bool, 40, 2 > attack_shadow
const Piece pieceAt(Square sq) const
bool isNormal() const
INVALID でも PASS でもない.
int y() const
将棋としてのY座標を返す.
PieceMask last_add_effect
const Piece pieceOnBoard(Square sq) const
static void makeLongAttackOne(StateInfo &info, Piece piece, Direction d)
bool test(unsigned int i) const
const Offset getShortOffsetNotKnight(Offset32 offset32) const
Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Knight以外のShortの利きのoffsetの場合はそ...
int x() const
将棋としてのX座標を返す.
bool hasLastMove(size_t last=1) const
const Offset getOffsetForBlack(Direction dir) const
黒にとってのoffsetを返す
const Piece pieceOf(int num) const
Square kingSquare() const
Square mobilityOf(Direction d, int num) const
bool isPromoted() const
promoteした駒かどうかをチェックする
CArray2d< long_attack_t, 40, 8 > long_attack_cache
static int classifyEffect9(const NumEffectState &state, Player player, Square to)
unsigned int index() const
bool isBetween(Square t, Square p0, Square p1) const
p0, p1の間にtがあるかどうか.
const checkmate::King8Info king8Info(Player king) const
CArray< pattern_square_t, Square::SIZE > pattern_cache
const Square square() const
PtypeO
Player + Ptype [-15, 15] PtypeO の O は Owner の O.
const NumEffectState * state
CArray< PieceMask, 2 > pin
void fill(const T_simple &value=T_simple())
constexpr bool isPiece(Ptype ptype)
ptypeが空白やEDGEでないかのチェック
static bool effectiveAttack(NumEffectState &state, Move move, int depth)
move を指した後,alt(move.player())が取ると詰みかどうか.
static void updateCache(StateInfo &)
unsigned int libertyCount() const
libertyの数
unsigned int ptypeOIndex(PtypeO ptypeo)
static bool hasSafeCapture(NumEffectState &state, Move)
const BoardTable Board_Table
static void updateCacheOne(Square target, StateInfo &info)