Go to the documentation of this file.
3 #ifndef OSL_NUM_EFFECT_STATE_H
4 #define OSL_NUM_EFFECT_STATE_H
23 bool operator==(
const NumEffectState& st1,
const NumEffectState& st2);
31 #if OSL_WORDSIZE == 32
91 #ifdef ALLOW_KING_ABSENCE
109 Piece attacker_piece;
117 from, king_position);
205 assert(p.
owner() == P);
207 Square king=kingSquare<P>();
213 return pinnedDir<BLACK>(p);
215 return pinnedDir<WHITE>(p);
224 assert(p.
owner() == P);
232 return pinnedCanMoveTo<BLACK>(p, to);
234 return pinnedCanMoveTo<WHITE>(p, to);
242 assert(pinned.
owner() == P);
251 return pinAttacker<BLACK>(pinned);
253 return pinAttacker<WHITE>(pinned);
292 template <Ptype PTYPE>
327 mask&=NumBitmapEffect::playerEffectMask<P>();
345 template <Ptype PTYPE>
347 static_assert((PTYPE ==
LANCE || PTYPE ==
BISHOP || PTYPE ==
ROOK),
"ptype");
348 return longEffectAt<PTYPE>(to, P).any();
354 template <Ptype PTYPE>
357 return allEffectAt<PTYPE>(attack, target).any();
362 template <Ptype PTYPE>
365 mask_t mask=allEffectAt<PTYPE>(attack, target);
376 template<Direction Dir,Player P>
383 : mask_t::makeDirect(0))
386 : mask_t::makeDirect(0))
389 : mask_t::makeDirect(0)));
395 int num=mask1.takeOneBit()+NumBitmapEffect::longToNumOffset;
410 assert(piece.
owner()==player);
492 return hasEffectByWithRemove<BLACK>(target,removed);
494 return hasEffectByWithRemove<WHITE>(target,removed);
502 template <Ptype PTYPE>
505 mask_t mask=allEffectAt<PTYPE>(attack, target);
510 template <Ptype PTYPE>
513 mask_t mask=allEffectAt<PTYPE>(attack, target);
528 assert(
pieceOf(piece).isOnBoardByOwner(owner));
539 assert(piece.
owner() == owner);
595 return hasEffectAt<alt(P)>(
kingSquare(P),attack_piece);
600 return hasEffectAt<BLACK>(target, attackerPiece);
602 return hasEffectAt<WHITE>(target, attackerPiece);
615 if (mask.none())
return false;
620 if (mask.hasMultipleBit())
648 template <
bool show_error>
675 template <
class Function>
682 template <
class Function>
690 template <Player P,
class Function>
697 assert(P == move.
player());
726 template<Player P,Ptype T,
typename F>
738 template<Player P,Ptype T,
typename F>
753 template<Player P,
class Action>
756 #if OSL_WORDSIZE == 64
760 const int num=mask.takeOneBit();
761 action.template doAction<P>(
pieceOf(num),sq);
763 #elif OSL_WORDSIZE == 32
767 const int num=mask0.takeOneBit();
768 action.template doAction<P>(
pieceOf(num),sq);
773 const int num=mask1.takeOneBit()+32;
774 action.template doAction<P>(
pieceOf(num),sq);
783 template<Player P,
class Action>
787 forEachEffect<P,Action>(pieceMask, sq, action);
794 template<Player P,
class Action>
799 forEachEffect<P,Action>(pieceMask, sq, action);
807 template<Player P,
class Action>
811 forEachEffect<P,Action>(
pieces, sq, action);
815 template<Player P,Ptype Type,
class Action,Direction Dir>
817 template<Player P,Ptype Type,
class Action,Direction Dir>
820 action.template doAction<P>(this->
pieceAt(pieceSquare),pieceSquare+offset);
823 template<Player P,Ptype Type,
class Action,Direction Dir>
827 template<Player P,Ptype Type,
class Action,Direction Dir>
829 template<Player P,Ptype Type,
class Action,Direction Dir>
834 Square sq=pieceSquare+offset;
836 action.template doAction<P>(piece,sq);
837 action.template doAction<P>(piece,sq);
840 template<Player P,Ptype Type,
class Action,Direction Dir>
852 template<Player P,Ptype Type,
class Action>
854 template<
class Action>
862 template <
class Function,
bool InterestEmpty>
864 template <Player P,
class Function,
bool InterestEmpty>
878 return this->safeCaptureNotByKing<BLACK>(target, king);
880 return this->safeCaptureNotByKing<WHITE>(target, king);
887 template <
class Action>
890 this->
template forEachEffect<BLACK>(pos,a);
892 this->
template forEachEffect<WHITE>(pos,a);
904 template <Player P,
class Function>
906 Square from,
Square to,
int promoteMask,Function& func);
909 Piece& oldPiece,
int& num,
929 template <Player P,
class Function>
935 int& numIndex,
mask_t& numMask,
951 template <Player P,
class Function>
953 Piece target,
int promoteMask,Function& func);
959 PtypeO& new_ptypeo,
int& num0,
int& num1,
960 int& num1Index,
mask_t& num1Mask,
973 int num1Index,
mask_t num1Mask,
982 template<Direction DIR>
1001 #ifdef ALLOW_KING_ABSENCE
1006 if(!
isLong(longD) || (lastDir!=
UL && longD==lastDir))
return;
1040 template <osl::Player P,
typename Function>
1043 Square from,
Square to,
int promoteMask, Function& func)
1057 king_mobility_backup,
1059 effected_mask_backup, effected_changed_mask_backup,
1078 king_mobility_backup,
1079 promoted_backup, effected_mask_backup, effected_changed_mask_backup,
1084 template <osl::Player P,
typename Function>
1098 prologueDrop(player, to, ptype, oldPiece, num, ptypeO, numIndex, numMask,
1099 pin_or_open_backup, king_mobility_backup,
1100 effected_mask_backup,effected_changed_mask_backup,
1117 epilogueDrop(player, to, ptype, oldPiece, num, ptypeO, numIndex, numMask,
1118 pin_or_open_backup, king_mobility_backup,
1119 effected_mask_backup,effected_changed_mask_backup,
1124 template <osl::Player P,
typename Function>
1127 int promoteMask,Function& func)
1131 int num0, num1, num1Index;
1140 prologueCapture(player, from, to, target, promoteMask, oldPiece, oldPtypeO,
1141 capturePtypeO,
newPtypeO, num0, num1, num1Index,num1Mask,
1142 pin_or_open_backup, king_mobility_backup,
1144 effected_mask_backup, effected_changed_mask_backup,
1150 if (capturePtype==
PAWN)
1152 clearPawn(
alt(P),to);
1177 epilogueCapture(player, from, to, target, oldPiece, oldPtypeO, capturePtypeO,
newPtypeO,
1178 num0, num1, num1Index,num1Mask,
1179 pin_or_open_backup, king_mobility_backup,
1180 promoted_backup,effected_mask_backup, effected_changed_mask_backup,
1185 template <
class Action>
1190 switch ((
int)piece.
ptypeO()) {
1191 case NEW_PTYPEO(
WHITE,
PAWN): forEachEffectOfPiece<WHITE,PAWN,Action>(pieceSquare,action);
break;
1192 case NEW_PTYPEO(
WHITE,
LANCE): forEachEffectOfPiece<WHITE,LANCE,Action>(pieceSquare,action);
break;
1193 case NEW_PTYPEO(
WHITE,
KNIGHT): forEachEffectOfPiece<WHITE,KNIGHT,Action>(pieceSquare,action);
break;
1194 case NEW_PTYPEO(
WHITE,
SILVER): forEachEffectOfPiece<WHITE,SILVER,Action>(pieceSquare,action);
break;
1195 case NEW_PTYPEO(
WHITE,
PPAWN): forEachEffectOfPiece<WHITE,PPAWN,Action>(pieceSquare,action);
break;
1196 case NEW_PTYPEO(
WHITE,
PLANCE): forEachEffectOfPiece<WHITE,PLANCE,Action>(pieceSquare,action);
break;
1199 case NEW_PTYPEO(
WHITE,
GOLD): forEachEffectOfPiece<WHITE,GOLD,Action>(pieceSquare,action);
break;
1200 case NEW_PTYPEO(
WHITE,
BISHOP): forEachEffectOfPiece<WHITE,BISHOP,Action>(pieceSquare,action);
break;
1202 case NEW_PTYPEO(
WHITE,
ROOK): forEachEffectOfPiece<WHITE,ROOK,Action>(pieceSquare,action);
break;
1203 case NEW_PTYPEO(
WHITE,
PROOK): forEachEffectOfPiece<WHITE,PROOK,Action>(pieceSquare,action);
break;
1204 case NEW_PTYPEO(
WHITE,
KING): forEachEffectOfPiece<WHITE,KING,Action>(pieceSquare,action);
break;
1205 case NEW_PTYPEO(
BLACK,
PAWN): forEachEffectOfPiece<BLACK,PAWN,Action>(pieceSquare,action);
break;
1206 case NEW_PTYPEO(
BLACK,
LANCE): forEachEffectOfPiece<BLACK,LANCE,Action>(pieceSquare,action);
break;
1207 case NEW_PTYPEO(
BLACK,
KNIGHT): forEachEffectOfPiece<BLACK,KNIGHT,Action>(pieceSquare,action);
break;
1208 case NEW_PTYPEO(
BLACK,
SILVER): forEachEffectOfPiece<BLACK,SILVER,Action>(pieceSquare,action);
break;
1209 case NEW_PTYPEO(
BLACK,
PPAWN): forEachEffectOfPiece<BLACK,PPAWN,Action>(pieceSquare,action);
break;
1210 case NEW_PTYPEO(
BLACK,
PLANCE): forEachEffectOfPiece<BLACK,PLANCE,Action>(pieceSquare,action);
break;
1213 case NEW_PTYPEO(
BLACK,
GOLD): forEachEffectOfPiece<BLACK,GOLD,Action>(pieceSquare,action);
break;
1214 case NEW_PTYPEO(
BLACK,
BISHOP): forEachEffectOfPiece<BLACK,BISHOP,Action>(pieceSquare,action);
break;
1216 case NEW_PTYPEO(
BLACK,
ROOK): forEachEffectOfPiece<BLACK,ROOK,Action>(pieceSquare,action);
break;
1217 case NEW_PTYPEO(
BLACK,
PROOK): forEachEffectOfPiece<BLACK,PROOK,Action>(pieceSquare,action);
break;
1218 case NEW_PTYPEO(
BLACK,
KING): forEachEffectOfPiece<BLACK,KING,Action>(pieceSquare,action);
break;
1223 template <osl::Player P, osl::Ptype Type,
class Action>
1227 forEachEffectOfPieceDir<P,Type,Action,UL>(pieceSquare,action);
1228 forEachEffectOfPieceDir<P,Type,Action,U>(pieceSquare,action);
1229 forEachEffectOfPieceDir<P,Type,Action,UR>(pieceSquare,action);
1230 forEachEffectOfPieceDir<P,Type,Action,L>(pieceSquare,action);
1231 forEachEffectOfPieceDir<P,Type,Action,R>(pieceSquare,action);
1232 forEachEffectOfPieceDir<P,Type,Action,DL>(pieceSquare,action);
1233 forEachEffectOfPieceDir<P,Type,Action,D>(pieceSquare,action);
1234 forEachEffectOfPieceDir<P,Type,Action,DR>(pieceSquare,action);
1235 forEachEffectOfPieceDir<P,Type,Action,UUL>(pieceSquare,action);
1236 forEachEffectOfPieceDir<P,Type,Action,UUR>(pieceSquare,action);
1237 forEachEffectOfPieceLongDir<P,Type,Action,LONG_UL>(pieceSquare,action);
1238 forEachEffectOfPieceLongDir<P,Type,Action,LONG_U>(pieceSquare,action);
1239 forEachEffectOfPieceLongDir<P,Type,Action,LONG_UR>(pieceSquare,action);
1240 forEachEffectOfPieceLongDir<P,Type,Action,LONG_L>(pieceSquare,action);
1241 forEachEffectOfPieceLongDir<P,Type,Action,LONG_R>(pieceSquare,action);
1242 forEachEffectOfPieceLongDir<P,Type,Action,LONG_DL>(pieceSquare,action);
1243 forEachEffectOfPieceLongDir<P,Type,Action,LONG_D>(pieceSquare,action);
1244 forEachEffectOfPieceLongDir<P,Type,Action,LONG_DR>(pieceSquare,action);
bool hasEffectByNotPinnedAndKing(Player pl, Square target) const
{pinされている駒, 玉以外}からの利きがある.
const mask_t getMask(int num) const
const Piece pieceAt(Square sq) const
bool isConsistent(bool showError=true) const
bool pinnedCanMoveTo(Piece p, Square to) const
void doUndoCaptureMove(Player2Type< P > player, Square from, Square to, Piece target, int promoteMask, Function &func)
constexpr Direction primDirUnsafe(Direction d)
8方向について,primitiveな4方向を求める dとしてknight, INVALIDなども来る
const PieceMask & piecesOnBoard(Player p) const
const Piece findCheapAttack(Player P, Square square) const
void epilogueCapture(Player2Type< P >, Square from, Square to, Piece target, Piece oldPiece, PtypeO oldPtypeO, PtypeO capturePtypeO, PtypeO newPtypeO, int num0, int num1, int num1Index, mask_t num1Mask, const CArray< PieceMask, 2 > &pin_or_open_backup, const KingMobility &king_mobility_backup, const PieceMask &promoted_backup, const CArray< PieceMask, 2 > &effected_mask_backup, const CArray< PieceMask, 2 > &effected_changed_mask_backup, const CArray< uint64_t, 2 > &king8infos_backup, const MobilityTable &mobility_backup)
const Offset offset() const
返り値が0なら長い利きがない, 0以外なら辿るのに必要なoffset (2005/3/25 に仕様変更 - 長い利きだが隣の場合もoffsetを返す)
void copyFrom(const NumEffectState &src)
主要部分を高速にコピーする.
const Piece findCheapAttackNotBy(Player P, Square square, const PieceMask &ignore) const
bool isOnBoard() const
盤面上を表すかどうかの判定. 1<=x() && x()<=9 && 1<=y() && y()<=9 Squareの内部表現に依存する.
Piece pinAttacker(Piece pinned) const
const BoardTable Board_Table
constexpr Direction inverse(Direction d)
Piece safeCaptureNotByKing(Square target, Piece king) const
玉の素抜きなしに合法手でtargetに移動可能かを判定
const checkmate::King8Info king8Info(Player king) const
uint64_t Iking8Info(Player king) const
effect::NumSimpleEffectTable effects
constexpr Player alt(Player player)
const EffectContent getEffect(PtypeO ptypeo, Square from, Square to) const
fromにいるptypeoがtoに利きを持つか?
void doCaptureMove(Square from, Square to, Piece target, int promoteMask)
static const Offset blackOffset()
bool findCheckPiece(Piece &attack_piece) const
王手駒を探す
bool isDirectCheck(Move move) const
const PieceMask effectedChanged(Player pl) const
前の指手でeffectedMask(pl)が変化したか.
const NumBitmapEffect effectSetAt(Square sq) const
void doUndoSimpleMove(Player2Type< P > player, Square from, Square to, int promoteMask, Function &func)
Offset32Base< 8, 9 > Offset32
int countEffect(Player player, Square target, PieceMask pins) const
利きの数を数える.
EffectedNumTable effectedNumTable
effected num
bool isOnBoardNum(int num) const
bool hasChangedEffects() const
void forEachEffectOfPiece(Square pieceSquare, Action &action) const
pieceSquareにある駒によって利きを受けるすべてのsquare (空白含む)について actionを実行する
void generateWithFullUnpromotions(MoveVector &) const
打歩詰め絡み以外では有利にはならない手も含め, 全ての合法手を生成す る(Move::ignoredUnpromoteも生成する).
static const Piece EMPTY()
const mask_t allEffectAt(Player P, Square target) const
const EffectedNumTable & longEffectNumTable() const
Direction getLongDirection(Offset32 offset32) const
void forEachEffectOfPieceDir(Square, Action &, Int2Type< false >) const
void epilogueDrop(Player2Type< P >, Square to, Ptype ptype, Piece oldPiece, int num, PtypeO ptypeO, int numIndex, mask_t numMask, const CArray< PieceMask, 2 > &pin_or_open_backup, const KingMobility &king_mobility_backup, const CArray< PieceMask, 2 > &effected_mask_backup, const CArray< PieceMask, 2 > &effected_changed_mask_backup, const CArray< uint64_t, 2 > &king8infos_backup, const MobilityTable &mobility_backup)
const Piece findLongAttackAt(Player owner, int piece, Direction d) const
pieceのd方向から長い利きがある場合にその駒を返す。
mobility::MobilityTable mobilityTable
mobility
Direction getShort8(Square from, Square to) const
void prologueSimple(Player2Type< P >, Square from, Square to, int promoteMask, Piece &oldPiece, int &num, PtypeO &oldPtypeO, PtypeO &new_ptypeo, CArray< PieceMask, 2 > &pin_or_open_backup, KingMobility &king_mobility_backup, PieceMask &promoted_backup, CArray< PieceMask, 2 > &effected_mask_backup, CArray< PieceMask, 2 > &effected_changed_mask_backup, CArray< uint64_t, 2 > &king8infos_backup, MobilityTable &mobility_backup)
const mask_t selectLong() const
void clearEffectedChanged()
PtypeO newPtypeO(Player player, Ptype ptype)
const PieceMask effectedMask(Player pl) const
pl からの利きが(1つ以上)ある駒一覧
void epilogueSimple(Square from, Square to, Piece oldPiece, int num, PtypeO oldPtypeO, PtypeO newPtypeO, const CArray< PieceMask, 2 > &pin_or_open_backup, const KingMobility &king_mobility_backup, const PieceMask &promoted_backup, const CArray< PieceMask, 2 > &effected_mask_backup, const CArray< PieceMask, 2 > &effected_changed_mask_backup, const CArray< uint64_t, 2 > &king8infos_backup, const MobilityTable &mobility_backup)
const NumBitmapEffect effectSetAt(Square pos) const
ある位置の利きデータを取り出す.
void forEachEffectOfPtypeO(Square, Ptype, Function &f) const
GeneralMask< mask_int_t > mask_t
bool isPawnDropCheckmate(Move move) const
bool hasEffectIf(PtypeO ptypeo, Square attacker, Square target) const
attackerにptypeoの駒がいると仮定した場合にtargetに利きがあるかどうか を stateをupdateしないで確かめる.
bool isSafeMove(Move move) const
void makeUnmakePass(Function &f)
void clearPawn(Player pl, Square sq)
(internal)
bool hasEffectAt(Square target) const
対象とするマスにあるプレイヤーの利きがあるかどうか.
void forEachEffect(Square sq, Action &action) const
sq への利きを持つ各駒に関して処理を行う.
const PtypeTable Ptype_Table
int promoteMask() const
pieceに使うためのmaskなので
static NumBitmapEffect playerEffect()
const mask_t longEffectAt(Square target, Player owner) const
bool inCheck(Player P) const
Pの玉が王手状態
Square kingMobilityAbs(Player p, Direction d) const
const mask_t longEffectAt(Square target) const
bool longEffectChanged() const
const Piece pieceOf(int num) const
void recalcPinOpen(Square changed, Direction &lastDir, Player defense)
const Piece findAttackNotBy(Player P, Square square, const PieceMask &ignore) const
static mask_t playerEffectMask()
const Piece findAttackAt(Player attack, Square target) const
return a piece s.t.
void generateAllUnsafe(MoveVector &) const
自殺を含めてすべての手を生成
bool hasEffectAt(Square target, Piece &attackerPiece) const
const mask_t longEffectAt(Square target, Player owner) const
void forEachEffect(Player P, Square pos, Action &a) const
forEachEffect の Player のtemplate 引数を通常の引数にしたバージョン
unsigned int uintValue() const
bool hasEffectAt(Player P, Square target, Piece &attackerPiece) const
const Piece pieceOnBoard(Square sq) const
bool anyEffectChanged() const
bool isPieceStand() const
const Piece selectCheapPiece(PieceMask effect) const
利きの中から安そうな駒を選ぶ
const NumBitmapEffect changedPieces() const
void clearChangedEffects()
CArray< PieceMask, 2 > effected_mask
void makePinOpenDir(Square target, PieceMask &pins, PieceMask const &onBoard, Player defense)
const Piece findLongAttackAt(Piece piece, Direction d) const
bool hasEffectByPtypeStrict(Player attack, Square target) const
target に ptype の利きがあるか? 成不成を区別
bool hasEffectNotBy(Player player, Piece piece, Square target) const
対象とするマスにあるプレイヤーの(ただしある駒以外)利きがあるかどうか.
void prologueCapture(Player2Type< P >, Square from, Square to, Piece target, int promoteMask, Piece &oldPiece, PtypeO &oldPtypeO, PtypeO &capturePtypeO, PtypeO &new_ptypeo, int &num0, int &num1, int &num1Index, mask_t &num1Mask, CArray< PieceMask, 2 > &pin_or_open_backup, KingMobility &king_mobility_backup, PieceMask &promoted_backup, CArray< PieceMask, 2 > &effected_mask_backup, CArray< PieceMask, 2 > &effected_changed_mask_backup, CArray< uint64_t, 2 > &king8infos_backup, MobilityTable &mobility_backup)
Piece pinAttacker(Piece pinned) const
Pのpinされた駒から,そのpinの原因となっている長い利きを持つ駒を得る.
bool inCheck() const
手番の玉が王手状態
static bool isEmptyNum(int num)
bool isOpenCheck(Move move) const
bool pinnedCanMoveTo(Piece p, Square to) const
pinされた駒pがtoに動けるか? pinに関係がなければtoへ動けるという前提
Direction pinnedDir(Piece p) const
pinされた駒がPのKingから見てどの方向か? Pから見たdirectionを返す
void forEachEffectNotBy(Square sq, Piece piece, Action &action) const
sq に移動する move を生成して action の member を呼び出す
bool hasLongEffectAt(Player P, Square to) const
あるマスにPTYPEの長い利きがあるかどうか.
bool hasEffectByPiece(Piece attack, Square target) const
駒attack が target に利きを持つか (旧hasEffectToと統合)
bool wasCheckEvasion(Move last_move) const
Square kingMobilityOfPlayer(Player p, Direction d) const
玉がd方向にどこまで動けるかを返す
void forEachOnBoardPtypeStrict(F &func) const
T の成不成を区別
CArray< PieceMask, 2 > pieces_onboard
Piece safeCaptureNotByKing(Player P, Square target) const
bool hasEffectByWithRemove(Player player, Square target, Square removed) const
NumEffectState(const SimpleState &st=SimpleState(HIRATE))
CArray< PieceMask, 2 > effected_changed_mask
PieceMask pinOrOpen(Player king) const
void setPawn(Player pl, Square sq)
(internal)
const PieceMask promotedPieces() const
const Square from() const
const Offset getOffsetForBlack(Direction dir) const
黒にとってのoffsetを返す
CArray< PieceMask, 2 > pin_or_open
PtypeO
Player + Ptype [-15, 15] PtypeO の O は Owner の O.
bool isAlmostValidMove(Move move) const
合法手かどうかを簡単に検査する.局面に依存するチェックのみ. ルール上指せない手である可能性がある場合は,isValidMove を用いる.
PtypeO captured(PtypeO ptypeO)
unpromoteすると共に,ownerを反転する.
const PieceMask pin(Player king) const
bool inUnblockableCheck(Player target) const
target の王に合駒可能でない王手がかかっているかどうか.
void forEachEffectOfPieceLongDir(Square pieceSquare, Action &action, Int2Type< true >) const
bool isCheck(Move move) const
bool isEmptyBetween(Square from, Square to, Offset offset, bool pieceExistsAtTo=false) const
bool hasUnblockableEffect() const
短い利きがある.長い利きの隣も含む
Direction getShort8Unsafe(Square from, Square to) const
8方向にいない場合も適当なものを返す.
bool hasMultipleEffectAt(Player player, Square target) const
二つ以上の駒から利きがある.
void forEachEffect(Square sq, Action &action, const PieceMask &pin) const
sq にある駒を取る move を生成して action の member を呼び出す.
Square kingSquare() const
const BoardMask changedEffects() const
constexpr Direction primDir(Direction d)
8方向について,primitiveな4方向を求める
constexpr bool isLong(Direction d)
void forEachEffect(const PieceMask &pieces, Square sq, Action &action) const
bool isPromoted(Ptype ptype)
ptypeがpromote後の型かどうかのチェック
bool operator==(Square l, Square r)
bool hasEffect() const
短い利きがあるか,間がemptyなら長い利きがある
const Square square() const
constexpr Direction longToShort(Direction d)
friend bool operator==(const NumEffectState &st1, const NumEffectState &st2)
駒番に依存した局面(インスタンス)比較をする.
void forEachEffectOfPtypeO(Square, PtypeO, Function &f) const
PtypeO が Square にいると仮定した時にの利きを列挙.
const Offset getShortOffset(Offset32 offset32) const
Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Shortの利きのoffsetの場合はそれ自身を返す.
const BoardMask changedEffects(Player pl) const
void doUndoDropMove(Player2Type< P > player, Square to, Ptype ptype, Function &func)
int countEffect(Player pl) const
void showEffect(std::ostream &os) const
void forEachEffectOfPieceLongDir(Square pieceSquare, Action &action) const
const Square get(Direction d, int num) const
const Piece findThreatenedPiece(Player P) const
取られそうなPの駒で価値が最大のもの
const BoardMask changedEffects(Player pl) const
CArray< Piece, Piece::SIZE > pieces
全てのpieceが登録されている
const Piece kingPiece() const
bool hasEffectByNotPinned(Player pl, Square target) const
pinされている駒以外からの利きがある.
static bool isPieceNum(int num)
void doDropMove(Square to, Ptype ptype)
const PieceMask checkShadow(Player attack) const
attack の駒で動くと開き王手になる可能性がある集合
static const Square makeDirect(int value)
void forEachEffectOfPieceDir(Square pieceSquare, Action &action, Int2Type< true >) const
void prologueDrop(Player2Type< P >, Square to, Ptype ptype, Piece &oldPiece, int &num, PtypeO &ptypeO, int &numIndex, mask_t &numMask, CArray< PieceMask, 2 > &pin_or_open_backup, KingMobility &king_mobility_backup, CArray< PieceMask, 2 > &effected_mask_backup, CArray< PieceMask, 2 > &effected_changed_mask_backup, CArray< uint64_t, 2 > &king8infos_backup, MobilityTable &mobility_backup)
void makeUnmakeMove(Player2Type< P > player, Move move, Function &f)
CArray< uint64_t, 2 > king8infos
bool hasEffectInDirection(Square to) const
あるマスにあるDirectionでの長い利きがあるかどうか.
void doSimpleMove(Square from, Square to, int promoteMask)
bool hasEffectByPtype(Player attack, Square target) const
target に ptype の利きがあるか? 成不成を区別しない
void forEachEffectOfPieceDir(Square pieceSquare, Action &action) const
bool operator!=(Offset l, Offset r)
const mask_t longEffectAt(Square target) const
static const mask_t longEffectMask()
KingMobility king_mobility
void generateLegal(MoveVector &) const
全ての合法手を生成する.
bool hasEffectByWithRemove(Square target, Square removed) const
void makeUnmakeMove(Move move, Function &f)
static const Square STAND()
Square mobilityOf(Direction d, int num) const
static bool isEdgeNum(int num)
void findEffect(Player P, Square target, PieceVector &out) const
target に利きのあるPieceをoutに格納する
bool hasEffectAt(Player player, Square target) const
対象とするマスにあるプレイヤーの利きがあるかどうか.
#define NEW_PTYPEO(player, ptype)
const Piece findLongAttackAt(Square square, Direction d) const
const Piece findAttackAtStrict(Player attack, Square target) const
const NumBitmapEffect changedPieces() const
int countEffect(Player player, Square target) const
利きの数を数える.
void clearBit()
unpromote(PTYPE) の駒のbit を消す
PieceMask makePinOpen(Square target, Player defense)
void forEachOnBoard(F &func) const
T は isBasic でなくても動くが unpromote(T) の結果と同じ.
const PtypeO PTYPEO_EDGE __attribute__((unused))
void forEachEffectOfPieceLongDir(Square, Action &, Int2Type< false >) const
Square mobilityOf(Direction d, Piece p) const
const Piece findLongAttackAt(Player owner, Piece piece, Direction d) const
Direction pinnedDir(Piece p) const
constexpr Direction inverseUnsafe(Direction d)