3 #ifndef _PATTERNLONG2_H 4 #define _PATTERNLONG2_H 25 direction(d), direction2(INVALID),
self(s), target(t), same(ss)
30 direction(d), direction2(d2),
self(s), target(t), same(ss)
36 if (direction2 == INVALID || ! p.
isOnBoard())
46 if (move.
ptype() !=
self)
66 :
CountEffect2(attack, defense), target(t), promotable(p), same(s)
76 if (p.first.ptype() !=
target)
80 if (isPromotable(move, p.second) != promotable)
84 if (! p.first.isPiece())
86 return same == (p.first.owner() == move.
player());
90 if (p.first.ptype() !=
target)
96 if (! p.first.isPiece())
98 return same == (p.first.owner() == move.
player());
100 const std::string
name()
const;
119 const std::string
name()
const;
142 if (move.
ptype() !=
self)
144 PieceSquare pp = find(state, move, direction);
145 return target.
match(state, move, pp, env);
166 if (move.
ptype() !=
self)
168 const Piece p = find(state, move, direction);
169 return target2.
match(state, move, p);
182 if (move.
ptype() !=
self)
184 PieceSquare pp = find(state, move, attack);
186 && pp.second.canPromote(pp.first.isPiece() ?
alt(pp.first.owner()) :
alt(move.
player()))
bool match(const NumEffectState &, Move move, Piece p) const
static bool isPromotable(Move move, Square position)
bool match(const NumEffectState &state, Move move, const RatingEnv &env) const
constexpr Player alt(Player player)
Pattern(Direction d, Ptype s, Ptype t, bool ss, int attack, int defense)
bool match(const NumEffectState &state, Move move, PieceSquare p, const RatingEnv &env) const
bool matchOtherThanPromotable(const NumEffectState &state, Move move, PieceSquare p, const RatingEnv &env) const
const Piece pieceAt(Square sq) const
static const Piece EMPTY()
LongTarget(Ptype t, bool p, bool s, int attack, int defense)
bool match(const NumEffectState &state, Move move, const RatingEnv &env) const
static const Direction INVALID
bool isOnBoard() const
盤面上を表すかどうかの判定. 1<=x() && x()<=9 && 1<=y() && y()<=9 Squareの内部表現に依存する. ...
const Square from() const
static const Piece find(const NumEffectState &state, Move move, Direction direction)
const Square square() const
constexpr bool isPiece(Ptype ptype)
ptypeが空白やEDGEでないかのチェック
std::pair< Piece, Square > PieceSquare
bool match(const NumEffectState &state, Move move, const RatingEnv &) const
static Square nextSquare(Player player, Square start, Direction direction, Direction direction2)
const Square nextSquare(Player P, Square pos, Direction dr) const
next position from pos for player P.
Pattern(Direction d, Direction d2, Ptype s, Ptype t, bool ss, int attack, int defense)
static Square nextSquare(Move move, Direction direction, Direction direction2)
const std::string & name() const
const Offset getOffset(Direction dir) const
bool match(const NumEffectState &state, Move move, const RatingEnv &env) const
bool match(const NumEffectState &state, Square position, const RatingEnv &env) const
Piece nextPiece(Square cur, Offset diff) const
diff方向にあるPiece を求める.
LongTarget2(Ptype t, bool s)
const BoardTable Board_Table