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 54 bool isConsistent(
bool showError=
true)
const;
57 void showEffect(std::ostream& os)
const;
67 return pin_or_open[king]&piecesOnBoard(king);
72 return pin_or_open[
alt(attack)]&piecesOnBoard(attack);
76 return pin_or_open[king];
80 return king8infos[king];
86 king8Info(
Player king)
const;
90 const Square king = kingSquare(P);
91 #ifdef ALLOW_KING_ABSENCE 95 return hasEffectAt(
alt(P), king);
108 const Square king_position = kingSquare(target);
109 Piece attacker_piece;
110 if (hasEffectAt(
alt(target), king_position, attacker_piece)) {
117 from, king_position);
145 assert(hasChangedEffects());
150 return ret |= changedEffects(
WHITE);
157 return changedPieces().template hasLong<PTYPE>();
161 return changedPieces().template hasAny<PTYPE>();
172 return piecesOnBoard(
BLACK).test(num) || piecesOnBoard(
WHITE).test(num);
181 return mobilityOf(d, p.
number());
196 return kingMobilityAbs(p, d);
205 assert(p.
owner() == P);
206 assert(pinOrOpen(P).test(p.
number()));
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);
243 assert(pinOrOpen(P).test(pinned.
number()));
246 return pieceOf(attacker_num);
251 return pinAttacker<BLACK>(pinned);
253 return pinAttacker<WHITE>(pinned);
269 return effectSetAt(target).countEffect(player);
284 const int all = effect.countEffect(player);
292 template <Ptype PTYPE>
295 return effectSetAt(target).template selectBit<PTYPE>() & piecesOnBoard(P).template getMask<PTYPE>();
300 return effectSetAt(target).selectLong<PTYPE>() >> 8;
304 return longEffectAt<PTYPE>(target) & piecesOnBoard(owner).getMask(1);
308 return effectSetAt(target).selectLong() >> 8;
312 return longEffectAt(target) & piecesOnBoard(owner).getMask(1);
326 mask_t mask=effectSetAt(target).getMask(1);
327 mask&=NumBitmapEffect::playerEffectMask<P>();
337 mask_t mask=effectSetAt(target).getMask(1);
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);
367 mask &= promoted.
getMask<PTYPE>();
369 mask &= ~(promoted.
getMask<PTYPE>());
376 template<Direction Dir,Player P>
379 const PieceMask& pieces_onboard=piecesOnBoard(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);
411 PieceMask pieces_onboard=piecesOnBoard(player);
413 pieces_onboard.reset(num);
414 return (pieces_onboard&effectSetAt(target)).any();
421 PieceMask m=piecesOnBoard(pl)& ~pinOrOpen(pl) & effectSetAt(target);
430 PieceMask m=piecesOnBoard(pl)& ~pinOrOpen(pl) & effectSetAt(target);
441 mask_t mask=effectSetAt(target).getMask(1);
454 return effectSetAt(target).test(attack.
number());
478 return this->isEmptyBetween(attacker,target,effect.
offset());
488 hasEffectByWithRemove(
Square target,
Square removed)
const;
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);
515 mask &= promoted.
getMask<PTYPE>();
517 mask &= ~(promoted.
getMask<PTYPE>());
528 assert(pieceOf(piece).isOnBoardByOwner(owner));
539 assert(piece.
owner() == owner);
540 return findLongAttackAt(owner, piece.
number(), d);
545 return findLongAttackAt(piece.
owner(), piece, d);
549 return findLongAttackAt(pieceOnBoard(square), d);
562 return selectCheapPiece(piecesOnBoard(P) & effectSetAt(square));
573 return selectCheapPiece(pieces & effectSetAt(square));
579 pieces &= effectSetAt(square);
595 return hasEffectAt<alt(P)>(kingSquare(P),attack_piece);
600 return hasEffectAt<BLACK>(target, attackerPiece);
602 return hasEffectAt<WHITE>(target, attackerPiece);
613 const PieceMask& pieceMask=piecesOnBoard(P)&effectSetAt(target);
615 if (mask.none())
return false;
620 if (mask.hasMultipleBit())
623 attackerPiece=pieceOf(num);
631 bool isSafeMove(
Move move)
const;
632 bool isCheck(
Move move)
const;
633 bool isPawnDropCheckmate(
Move move)
const;
634 bool isDirectCheck(
Move move)
const;
635 bool isOpenCheck(
Move move)
const;
648 template <
bool show_error>
649 bool isAlmostValidMove(
Move move)
const;
650 bool isAlmostValidMove(
Move move,
bool show_error=
true)
const;
663 void generateWithFullUnpromotions(
MoveVector&)
const;
667 void makeMove(
Move move);
675 template <
class Function>
682 template <
class Function>
690 template <Player P,
class Function>
694 return makeUnmakePass(f);
696 assert(isAlmostValidMove(move));
697 assert(P == move.
player());
704 doUndoDropMove(player,to,move.
ptype(),f);
712 doUndoCaptureMove(player,from,to,captured,move.
promoteMask(),f);
716 doUndoSimpleMove(player,from,to,move.
promoteMask(),f);
720 bool wasCheckEvasion(
Move last_move)
const;
726 template<Player P,Ptype T,
typename F>
728 mask_t onMask=piecesOnBoard(P).template selectBit<T>() ;
732 Piece p = pieceOf(num);
738 template<Player P,Ptype T,
typename F>
741 mask_t mask=piecesOnBoard(P).template selectBit<T>() ;
745 mask &= ~(promoted.
getMask<T>());
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>
786 const PieceMask pieceMask=piecesOnBoard(P)&effectSetAt(sq);
787 forEachEffect<P,Action>(pieceMask, sq, action);
794 template<Player P,
class Action>
797 PieceMask pieceMask=piecesOnBoard(P)&effectSetAt(sq);
799 forEachEffect<P,Action>(pieceMask, sq, action);
807 template<Player P,
class Action>
809 PieceMask pieces=piecesOnBoard(P)&effectSetAt(sq);
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>
831 Piece piece=this->pieceAt(pieceSquare);
834 Square sq=pieceSquare+offset;
835 for (;this->pieceAt(sq).isEmpty();sq+=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>
853 void forEachEffectOfPiece(
Square pieceSquare,Action & action)
const;
854 template<
class Action>
855 void forEachEffectOfPiece(
Piece piece,Action & action)
const;
862 template <
class Function,
bool InterestEmpty>
863 void forEachEffectOfPtypeO(
Square,
PtypeO, Function& f)
const;
864 template <Player P,
class Function,
bool InterestEmpty>
865 void forEachEffectOfPtypeO(
Square,
Ptype, Function& f)
const;
876 const Piece king = kingPiece(P);
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);
900 void doSimpleMove(
Square from,
Square to,
int promoteMask);
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,
972 PtypeO newPtypeO,
int num0,
int num1,
973 int num1Index,
mask_t num1Mask,
982 template<Direction DIR>
991 king_mobility[defense][DIR]=
static_cast<unsigned char>(sq.
uintValue());
993 int num1=longEffectNumTable()[num][DIR];
1000 Square target=kingSquare(defense);
1001 #ifdef ALLOW_KING_ABSENCE 1006 if(!
isLong(longD) || (lastDir!=
UL && longD==lastDir))
return;
1012 int oldNum=pieceAt(oldPos).number();
1014 pin_or_open[defense].reset(oldNum);
1021 king_mobility[defense][shortD]=
static_cast<unsigned char>(sq.
uintValue());
1023 int num1=longEffectNumTable()[num][shortD];
1025 pin_or_open[defense].set(num);
1029 void makePinOpen(
Player defense);
1031 void makeKing8Info();
1040 template <osl::Player P,
typename Function>
1043 Square from,
Square to,
int promoteMask, Function& func)
1055 prologueSimple(player, from, to, promoteMask, oldPiece, num, oldPtypeO, newPtypeO,
1057 king_mobility_backup,
1059 effected_mask_backup, effected_changed_mask_backup,
1076 epilogueSimple(from, to, oldPiece, num, oldPtypeO, newPtypeO,
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);
constexpr Direction primDirUnsafe(Direction d)
8方向について,primitiveな4方向を求める dとしてknight, INVALIDなども来る
const Piece findAttackAtStrict(Player attack, Square target) const
bool hasUnblockableEffect() const
短い利きがある.長い利きの隣も含む
int countEffect(Player player, Square target) const
利きの数を数える.
void forEachEffectNotBy(Square sq, Piece piece, Action &action) const
sq に移動する move を生成して action の member を呼び出す
constexpr Direction inverseUnsafe(Direction d)
bool hasLongEffectAt(Player P, Square to) const
あるマスにPTYPEの長い利きがあるかどうか.
void forEachEffect(Square sq, Action &action) const
sq への利きを持つ各駒に関して処理を行う.
Piece pinAttacker(Piece pinned) const
void forEachEffectOfPieceLongDir(Square, Action &, Int2Type< false >) const
void doUndoDropMove(Player2Type< P > player, Square to, Ptype ptype, Function &func)
bool hasEffectIf(PtypeO ptypeo, Square attacker, Square target) const
attackerにptypeoの駒がいると仮定した場合にtargetに利きがあるかどうか を stateをupdateしないで確かめる...
bool hasEffectByWithRemove(Player player, Square target, Square removed) const
bool hasEffectByNotPinned(Player pl, Square target) const
pinされている駒以外からの利きがある.
const Piece findLongAttackAt(Player owner, Piece piece, Direction d) const
mobility::MobilityTable mobilityTable
mobility
GeneralMask< mask_int_t > mask_t
bool hasEffectAt(Square target) const
対象とするマスにあるプレイヤーの利きがあるかどうか.
constexpr Direction inverse(Direction d)
const BoardMask changedEffects(Player pl) const
PieceMask pinOrOpen(Player king) const
constexpr Player alt(Player player)
void doUndoSimpleMove(Player2Type< P > player, Square from, Square to, int promoteMask, Function &func)
const Piece findAttackAt(Player attack, Square target) const
return a piece s.t.
bool pinnedCanMoveTo(Piece p, Square to) const
const PtypeO PTYPEO_EDGE __attribute__((unused))
static const mask_t longEffectMask()
bool isOnBoardNum(int num) const
bool operator==(const ProofDisproof &l, const ProofDisproof &r)
static const Offset blackOffset()
const PieceMask checkShadow(Player attack) const
attack の駒で動くと開き王手になる可能性がある集合
void recalcPinOpen(Square changed, Direction &lastDir, Player defense)
KingMobility king_mobility
bool inUnblockableCheck(Player target) const
target の王に合駒可能でない王手がかかっているかどうか.
static const Square makeDirect(int value)
bool hasEffectByPtype(Player attack, Square target) const
target に ptype の利きがあるか? 成不成を区別しない
const PieceMask pin(Player king) const
void makePinOpenDir(Square target, PieceMask &pins, PieceMask const &onBoard, Player defense)
void forEachEffectOfPieceLongDir(Square pieceSquare, Action &action, Int2Type< true >) const
static mask_t playerEffectMask()
const EffectedNumTable & longEffectNumTable() const
void makeUnmakeMove(Move move, Function &f)
bool hasEffect() const
短い利きがあるか,間がemptyなら長い利きがある
const NumBitmapEffect changedPieces() const
effect::NumSimpleEffectTable effects
Direction pinnedDir(Piece p) const
pinされた駒がPのKingから見てどの方向か? Pから見たdirectionを返す
bool findCheckPiece(Piece &attack_piece) const
王手駒を探す
static const Piece EMPTY()
void clearEffectedChanged()
bool hasChangedEffects() const
bool hasEffectByPiece(Piece attack, Square target) const
駒attack が target に利きを持つか (旧hasEffectToと統合)
CArray< PieceMask, 2 > effected_mask
void forEachOnBoard(F &func) const
T は isBasic でなくても動くが unpromote(T) の結果と同じ.
bool hasEffectByNotPinnedAndKing(Player pl, Square target) const
{pinされている駒, 玉以外}からの利きがある.
void forEachOnBoardPtypeStrict(F &func) const
T の成不成を区別
CArray< PieceMask, 2 > pieces_onboard
const BoardMask changedEffects(Player pl) const
const NumBitmapEffect effectSetAt(Square pos) const
ある位置の利きデータを取り出す.
const mask_t longEffectAt(Square target) const
const Offset offset() const
返り値が0なら長い利きがない, 0以外なら辿るのに必要なoffset (2005/3/25 に仕様変更 - 長い利きだが隣の場...
Offset32Base< 8, 9 > Offset32
PtypeO newPtypeO(Player player, Ptype ptype)
void forEachEffectOfPieceDir(Square, Action &, Int2Type< false >) const
void forEachEffect(Player P, Square pos, Action &a) const
forEachEffect の Player のtemplate 引数を通常の引数にしたバージョン
const Offset getOffsetForBlack(Direction dir) const
黒にとってのoffsetを返す
const mask_t longEffectAt(Square target) const
void forEachEffect(Square sq, Action &action, const PieceMask &pin) const
sq にある駒を取る move を生成して action の member を呼び出す.
static bool isEdgeNum(int num)
bool hasMultipleEffectAt(Player player, Square target) const
二つ以上の駒から利きがある.
const PtypeTable Ptype_Table
void makeUnmakePass(Function &f)
Square mobilityOf(Direction d, int num) const
const Piece findLongAttackAt(Piece piece, Direction d) const
bool hasEffectAt(Player player, Square target) const
対象とするマスにあるプレイヤーの利きがあるかどうか.
bool isOnBoard() const
盤面上を表すかどうかの判定. 1<=x() && x()<=9 && 1<=y() && y()<=9 Squareの内部表現に依存する. ...
const Square from() const
const BoardMask changedEffects() const
int countEffect(Player player, Square target, PieceMask pins) const
利きの数を数える.
const PieceMask effectedChanged(Player pl) const
前の指手でeffectedMask(pl)が変化したか.
Square kingMobilityOfPlayer(Player p, Direction d) const
玉がd方向にどこまで動けるかを返す
Square mobilityOf(Direction d, Piece p) const
Piece safeCaptureNotByKing(Player P, Square target) const
const Square get(Direction d, int num) const
void forEachEffectOfPieceLongDir(Square pieceSquare, Action &action) const
bool hasEffectAt(Square target, Piece &attackerPiece) const
const NumBitmapEffect effectSetAt(Square sq) const
const Piece findAttackNotBy(Player P, Square square, const PieceMask &ignore) const
const EffectContent getEffect(PtypeO ptypeo, Square from, Square to) const
fromにいるptypeoがtoに利きを持つか?
Direction pinnedDir(Piece p) const
static bool isEmptyNum(int num)
CArray< uint64_t, 2 > king8infos
int promoteMask() const
pieceに使うためのmaskなので
const Piece findLongAttackAt(Player owner, int piece, Direction d) const
pieceのd方向から長い利きがある場合にその駒を返す。
constexpr Direction primDir(Direction d)
8方向について,primitiveな4方向を求める
Piece pinAttacker(Piece pinned) const
Pのpinされた駒から,そのpinの原因となっている長い利きを持つ駒を得る.
bool hasEffectInDirection(Square to) const
あるマスにあるDirectionでの長い利きがあるかどうか.
void makeUnmakeMove(Player2Type< P > player, Move move, Function &f)
constexpr Direction longToShort(Direction d)
const Piece findCheapAttackNotBy(Player P, Square square, const PieceMask &ignore) const
const Piece findLongAttackAt(Square square, Direction d) const
const mask_t longEffectAt(Square target, Player owner) const
bool inCheck(Player P) const
Pの玉が王手状態
uint64_t Iking8Info(Player king) const
#define NEW_PTYPEO(player, ptype)
const Square square() const
bool operator!=(const ProofDisproof &l, const ProofDisproof &r)
const mask_t longEffectAt(Square target, Player owner) const
PtypeO
Player + Ptype [-15, 15] PtypeO の O は Owner の O.
Square kingMobilityAbs(Player p, Direction d) const
static NumBitmapEffect playerEffect()
CArray< PieceMask, 2 > effected_changed_mask
const Offset getShortOffset(Offset32 offset32) const
Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Shortの利きのoffsetの場合はそれ自身を返す...
const PieceMask & piecesOnBoard(Player p) const
bool hasEffectAt(Player P, Square target, Piece &attackerPiece) const
const mask_t allEffectAt(Player P, Square target) const
bool hasEffectByPtypeStrict(Player attack, Square target) const
target に ptype の利きがあるか? 成不成を区別
const Piece findCheapAttack(Player P, Square square) const
constexpr bool isLong(Direction d)
bool isPromoted(Ptype ptype)
ptypeがpromote後の型かどうかのチェック
void forEachEffectOfPieceDir(Square pieceSquare, Action &action, Int2Type< true >) const
void doUndoCaptureMove(Player2Type< P > player, Square from, Square to, Piece target, int promoteMask, Function &func)
bool pinnedCanMoveTo(Piece p, Square to) const
pinされた駒pがtoに動けるか? pinに関係がなければtoへ動けるという前提
const PieceMask effectedMask(Player pl) const
pl からの利きが(1つ以上)ある駒一覧
PtypeO captured(PtypeO ptypeO)
unpromoteすると共に,ownerを反転する.
static bool isPieceNum(int num)
Direction getShort8(Square from, Square to) const
const mask_t getMask(int num) const
bool hasEffectNotBy(Player player, Piece piece, Square target) const
対象とするマスにあるプレイヤーの(ただしある駒以外)利きがあるかどうか.
EffectedNumTable effectedNumTable
effected num
bool inCheck() const
手番の玉が王手状態
Direction getShort8Unsafe(Square from, Square to) const
8方向にいない場合も適当なものを返す.
bool longEffectChanged() const
bool isPieceStand() const
void clearChangedEffects()
const PieceMask promotedPieces() const
const NumBitmapEffect changedPieces() const
Direction getLongDirection(Offset32 offset32) const
bool anyEffectChanged() const
CArray< PieceMask, 2 > pin_or_open
void forEachEffectOfPiece(Square pieceSquare, Action &action) const
pieceSquareにある駒によって利きを受けるすべてのsquare (空白含む)について actionを実行する ...
void forEachEffectOfPieceDir(Square pieceSquare, Action &action) const
unsigned int uintValue() const
static const Square STAND()
const BoardTable Board_Table
void forEachEffect(const PieceMask &pieces, Square sq, Action &action) const