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;
47 int effect9 = classifyEffect9(state, turn, position);
48 cache[cur++] = basic + pair.first;
49 cache[cur++] = basic + AttackBase + pair.second;
50 cache[cur++] = basic + EffectBase + effect9;
57 cache[cur++] = basic + AttackBase +
PTYPE_EDGE;
59 assert(basic + EffectBase + effect9 < PatternCacheSize);
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)
66 if (op_king_distance < OpKingSize)
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)
74 if (my_king_distance < MyKingSize)
75 cache[cur++] = basic + MyKingBase + my_king_distance;
78 cache[cur++] = basic + PromotionBase;
80 cache[cur++] = basic + PromotionBase + 1;
84 cache[cur++] = basic + PinOpenBase + (target.
owner() == turn);
86 cache[cur++] = basic + PinOpenBase + 2 + (target.
owner() ==
alt(turn));
90 cache[cur++] = basic + LastToBase;
91 for (
int i=1; i<4; ++i) {
95 cache[cur++] = basic + LastToBase + i;
102 cache[cur++] = basic + LastEffectChangedBase;
105 cache[cur++] = basic + LastEffectChangedBase + ptype_index;
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;
174 attacked =
alt(attacked);
175 int index = (longAttackIndex(attacking)*
PTYPEO_SIZE
195 if (threat_at == attack_to
198 piece.
square(), attack_to)))
const Offset getShortOffsetNotKnight(Offset32 offset32) const
Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Knight以外のShortの利きのoffsetの場合はそれ自身を返す.
bool isBetween(Square t, Square p0, Square p1) const
p0, p1の間にtがあるかどうか.
const Offset getOffsetForBlack(Direction dir) const
黒にとってのoffsetを返す
void fill(const T_simple &value=T_simple())
void push_back(const T &e)
bool isNormal() const
INVALID でも PASS でもない.
const checkmate::King8Info king8Info(Player king) const
bool hasEffectAt(Square target) const
対象とするマスにあるプレイヤーの利きがあるかどうか.
Square mobilityOf(Direction d, int num) const
PieceMask pinOrOpen(Player king) const
bool isPromoted() const
promoteした駒かどうかをチェックする
const Square square() const
bool isOnBoardByOwner() const
piece がプレイヤーPの持ち物でかつボード上にある駒の場合は true.
const Piece pieceOnBoard(Square sq) const
const Piece pieceOf(int num) const
Square kingSquare() const
const Piece pieceAt(Square sq) const
unsigned int index() const
bool isPieceStand() const
int y() const
将棋としてのY座標を返す.
bool isNeighboring8(Square to) const
bool isEdge() const
onBoardから8近傍のオフセットを足した点がedgeかどうかの判定 そこそこ速くなった.
int x() const
将棋としてのX座標を返す.
unsigned int libertyCount() const
libertyの数
bool test(unsigned int i) const
bool hasLastMove(size_t last=1) const
const Move lastMove(size_t last=1) const
static void makeLongAttackOne(StateInfo &info, Piece piece, Direction d)
static void updateCache(StateInfo &)
static bool hasSafeCapture(NumEffectState &state, Move)
static void updateCacheOne(Square target, StateInfo &info)
static void updateCache(StateInfo &info)
static void supportAttack(const NumEffectState &state, Square to, const PieceMask &my_pin, const PieceMask &op_pin, Player turn, std::pair< Ptype, Ptype > &out)
const BoardTable Board_Table
unsigned int ptypeOIndex(PtypeO ptypeo)
constexpr bool isPiece(Ptype ptype)
ptypeが空白やEDGEでないかのチェック
PtypeO
Player + Ptype [-15, 15] PtypeO の O は Owner の O.
constexpr Player alt(Player player)
PtypeO altIfPiece(PtypeO ptypeO)
Pieceの時にはowner を反転する
static bool effectiveAttack(NumEffectState &state, Move move, int depth)
move を指した後,alt(move.player())が取ると詰みかどうか.
const NumEffectState * state
CArray2d< bool, 40, 2 > attack_shadow
const MoveStack * history
BoardMask changed_effects
CArray< pattern_square_t, Square::SIZE > pattern_cache
PieceMask last_add_effect
CArray< PieceMask, 2 > pin
CArray2d< long_attack_t, 40, 8 > long_attack_cache