1#ifndef OSL_PIECE_ON_BOARD_H
2#define OSL_PIECE_ON_BOARD_H
18 template<
class Action,
bool noCapturePromote=false>
32 action.unknownMove(from,target,p1,
promote(ptype),
true,P);
33 int y=(P==
BLACK ? target.
y() : 10-target.
y());
35 (((ptype==
LANCE || ptype==
PAWN) ? y==3 :
true )) &&
37 action.unknownMove(from,target,p1,ptype,
false,P);
40 action.unknownMove(from,target,p1,
promote(ptype),
true,P);
42 action.unknownMove(from,target,p1,ptype,
false,P);
45 action.unknownMove(from,target,p1,ptype,
false,P);
48 action.unknownMove(from,target,p1,ptype,
false,P);
72 template<Player P,Ptype T>
80 action.unknownMove(from,target,p1,
promote(T),
true,P);
82 (P==
BLACK ? target.
y()==1 : target.
y()==9))||
86 (T==
LANCE && (P==
BLACK ? target.
y()==2 : target.
y()==8))))
89 action.unknownMove(from,target,p1,T,
false,P);
91 template<Player P,Ptype T>
113 template <Player P,Ptype T,
bool useDirMask>
116 template <Player P,Ptype T>
130 template <Player P,Ptype T,
bool useDirMask>
132 template <Player P,Ptype T>
146 template <Player P,
bool useDirMask>
156 using move_generator::GeneratePieceOnBoard;
Direction pinnedDir(Piece p) const
pinされた駒がPのKingから見てどの方向か?
bool hasEffectByPiece(Piece attack, Square target) const
駒attack が target に利きを持つか (旧hasEffectToと統合)
bool hasEffectAt(Square target) const
対象とするマスにあるプレイヤーの利きがあるかどうか.
const PieceMask pin(Player king) const
PieceMask pinOrOpen(Player king) const
const Square square() const
int y() const
将棋としてのY座標を返す.
const PtypeTable Ptype_Table
bool canPromote(Ptype ptype)
ptypeがpromote可能な型かどうかのチェック promote済みの場合はfalseを返す
const BoardTable Board_Table
constexpr Direction primDirUnsafe(Direction d)
8方向について,primitiveな4方向を求める dとしてknight, INVALIDなども来る
constexpr Direction primDir(Direction d)
8方向について,primitiveな4方向を求める
constexpr Player alt(Player player)
Ptype promote(Ptype ptype)
promote可能なptypeに対して,promote後の型を返す promote不可のptypeを与えてはいけない.
static void generate(Player turn, const NumEffectState &state, Piece target, MoveVector &)
static void generatePtype(const NumEffectState &state, Piece p, Action &action, int dirMask=0)
Generate moves without stating the Ptype as template param.
static void generatePiece(const NumEffectState &state, Piece p, Square target, Piece p1, Action &action)
static void generate(const NumEffectState &state, Piece p, Action &action, int dirMask=0)
Generate moves without stating the Ptype as template param.
static void generatePtypeUnsafe(const NumEffectState &state, Piece p, Action &action, int dirMask)
Generate moves without stating the Ptype as template param.
static void generatePtypeUnsafe(const NumEffectState &state, Piece p, Action &action)
static void generatePtype(const NumEffectState &state, Piece p, Action &action)
static void generatePiecePtype(const NumEffectState &state, Piece p, Square target, Piece p1, Action &action)
static void generatePieceUnsafe(const NumEffectState &state, Piece p, Square target, Piece p1, Action &action)
駒pがマスtargetに利きをもっているとして,手を生成する.
static void generatePiecePtypeUnsafe(const NumEffectState &state, Piece p, Square target, Piece p1, Action &action)
PtypeがTの駒pがマスtargetに利きをもっているとして,手を生成する. p1 - targetにある駒