33 if (! (mask & (1<<direction)))
36 assert(! offset.
zero());
37 const int x = offset.
dx();
38 const int y = offset.
dy();
39 for (
int dy=-1; dy<=1; ++dy)
41 for (
int dx=-1; dx<=1; ++dx)
45 has_unblockable_effect =
true;
52 for (
int i=1; i<8; ++i)
54 const int long_x = x*i;
55 const int long_y = y*i;
56 const int target_x = x*(i+1);
57 const int target_y = y*(i+1);
62 for (
int i=1; i<9; ++i)
64 const int long_x = x*i;
65 const int long_y = y*i;
66 for (
int dy=-1; dy<=1; ++dy)
68 const int target_y = long_y+dy;
69 if ((target_y < -8) || (8 < target_y))
71 for (
int dx=-1; dx<=1; ++dx)
73 const int target_x = long_x+dx;
74 if ((target_x < -8) || (8 < target_x))
107 if (abs(from.
y() - target.
y()) > 3)
109 if (abs(from.
x() - target.
x()) > 2)
112 else if (ptype ==
LANCE)
114 if (abs(from.
x() - target.
x()) > 1)
static osl::SetUpRegister _initializer([](){ osl::Centering3x3::table.init();})
bool hasEffectIf(PtypeO ptypeo, Square attacker, Square target) const
attackerにptypeoの駒がいると仮定した場合にtargetに利きがあるかどうか を stateをupdateしないで確かめる.
unsigned int index() const
int dx() const
Offsetから一般に dxは求まらないので, ここでの入力は12近傍のみとする
int dy() const
Offsetから一般に dyは求まらないので, ここでの入力は12近傍のみとする
int y() const
将棋としてのY座標を返す.
bool isOnBoard() const
盤面上を表すかどうかの判定. 1<=x() && x()<=9 && 1<=y() && y()<=9 Squareの内部表現に依存する.
int x() const
将棋としてのX座標を返す.
CArray2d< Entry, PTYPEO_SIZE, Offset32::SIZE > table
static bool hasEffectFromTo(const NumEffectState &state, PtypeO ptypeo, Square from, Square target, Direction d)
static bool hasEffectNaive(const NumEffectState &state, PtypeO ptypeo, Square from, Square target)
const PtypeTable Ptype_Table
Ptype getPtype(PtypeO ptypeO)
const BoardTable Board_Table
unsigned int ptypeOIndex(PtypeO ptypeo)
Offset32Base< 8, 9 > Offset32
constexpr bool isPiece(Ptype ptype)
ptypeが空白やEDGEでないかのチェック
PtypeO
Player + Ptype [-15, 15] PtypeO の O は Owner の O.
constexpr bool isLong(Direction d)
PtypeO newPtypeO(Player player, Ptype ptype)