3 #ifndef FEATURE_POSITION_H 4 #define FEATURE_POSITION_H 49 static const std::string
name(
int x,
int old_x,
bool ,
Ptype);
51 :
Feature(
name(ix,iox,a,p)), x(ix), old_x(iox), ptype(p), attack(a) {}
56 return abs(move.
to().
x() - king.
x());
64 return abs(move.
from().
x() - king.
x());
68 if (ptype != move.
ptype())
70 return makeX(attack, state, move) == x && makeOldX(attack, state, move) == old_x;
74 const int x = makeX(attack, state, move), old_x = makeOldX(attack, state, move);
86 static const std::string
name(
int y,
int old_y,
bool ,
Ptype ptype);
88 :
Feature(
name(iy,ioy,a,p)), y(iy), old_y(ioy), ptype(p), attack(a) {}
93 int diff = move.
to().
y() - king.
y();
104 int diff = move.
from().
y() - king.
y();
111 if (ptype != move.
ptype())
113 return makeY(attack, state, move) == y && makeOldY(attack, state, move) == old_y;
117 const int y = makeY(attack, state, move) + 8;
118 const int old_y = makeOldY(attack, state, move) + 8;
127 static const std::string
name(
int x);
133 int mx = move.
to().
x();
142 return x == makeX(move);
149 static const std::string
name(
int y);
155 int my = move.
to().
y();
164 return y == makeY(move);
static int makeY(bool attack, const NumEffectState &state, Move move)
static std::string name(Ptype ptype, bool drop)
RelativeKingX(int ix, int iox, bool a, Ptype p)
bool match(const NumEffectState &, Move move, const RatingEnv &) const
constexpr Player alt(Player player)
bool match(const NumEffectState &, Move move, const RatingEnv &) const
int y() const
将棋としてのY座標を返す.
static int makeOldX(bool attack, const NumEffectState &state, Move move)
int x() const
将棋としてのX座標を返す.
SquareX(int ix, Ptype ptype, bool drop)
static int makeOldY(bool attack, const NumEffectState &state, Move move)
const char * getCsaName(Ptype ptype) const
Square kingSquare() const
const PtypeTable Ptype_Table
const Square from() const
static int index(bool attack, const NumEffectState &state, Move move)
DropPtype(Ptype p, bool d)
static int index(bool attack, const NumEffectState &state, Move move)
bool isBasic(Ptype ptype)
ptypeが基本型(promoteしていない)かのチェック
bool match(const NumEffectState &state, Move move, const RatingEnv &) const
static int makeX(Move move)
SquareY(int iy, Ptype ptype, bool drop)
RelativeKingY(int iy, int ioy, bool a, Ptype p)
static int makeX(bool attack, const NumEffectState &state, Move move)
static int index(Move move)
bool match(const NumEffectState &state, Move move, const RatingEnv &) const
static int makeY(Move move)