19 std::ostringstream os;
21 << (same ?
"=" :
"!") << (promotable ?
"p" :
"-");
26 std::ostringstream os;
28 << (same ?
"=" :
"!");
34 :
Feature(name(d, s)+
"-"+t.name()), direction(d), self(s), target(t)
44 assert(! diff.
zero());
50 return std::make_pair(p, cur);
54 return std::make_pair(p, cur);
62 return nextPieceOrEnd(state, start, diff);
69 if (p.second == move.
from())
70 p = nextPieceOrEnd(state, p.second, move.
player(), direction);
76 std::ostringstream os;
84 :
Feature(name(d, s)+
"--"+t2.name()), direction(d), self(s), target2(t2)
92 std::ostringstream os;
100 self(s), attack(a), target(t)
114 }
else if (ap ==
BISHOP) {
120 }
else if (ap ==
ROOK) {
const Offset getOffset(Direction dir) const
const Offset getShortOffset(Offset32 offset32) const
Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Shortの利きのoffsetの場合はそれ自身を返す.
const Square from() const
const Piece findAttackAt(Player attack, Square target) const
return a piece s.t.
const Square square() const
static const Piece EMPTY()
static const Piece EDGE()
const char * getCsaName(Ptype ptype) const
const Piece pieceOnBoard(Square sq) const
const Piece pieceAt(Square sq) const
static const Square STAND()
bool isOnBoard() const
盤面上を表すかどうかの判定. 1<=x() && x()<=9 && 1<=y() && y()<=9 Squareの内部表現に依存する.
const std::string & name() const
PatternBlock(Ptype s, Ptype a, LongTarget t)
static const PieceSquare find(const NumEffectState &state, Move move, Ptype attacker_ptype)
PatternLong2(Direction d, Ptype s, LongTarget2 t2)
PatternLong(Direction d, Ptype s, LongTarget t)
static const PieceSquare nextPieceOrEnd(const SimpleState &state, Square start, Player player, Direction direction)
direction方向に空白を進み、駒を探す
static const PieceSquare find(const NumEffectState &state, Move move, Direction direction)
static const Direction INVALID
std::pair< Piece, Square > PieceSquare
const PtypeTable Ptype_Table
Ptype unpromote(Ptype ptype)
ptypeがpromote後の型の時に,promote前の型を返す. promoteしていない型の時はそのまま返す
const BoardTable Board_Table
Offset32Base< 8, 9 > Offset32
constexpr Player alt(Player player)
static std::pair< int, int > count(const NumEffectState &state, Square position, const RatingEnv &env)
static std::string name(int attack, int defense)
const std::string name() const
const std::string name() const