7 :
Group(name(d, d2)), direction(d), direction2(d2)
9 for (
int attack=0; attack<3; ++attack) {
10 for (
int defense=0; defense<3; ++defense) {
13 push_back(
new Pattern(d, d2, static_cast<Ptype>(s), static_cast<Ptype>(t),
true, attack, defense));
14 push_back(
new Pattern(d, d2, static_cast<Ptype>(s), static_cast<Ptype>(t),
false, attack, defense));
16 push_back(
new Pattern(d, d2, static_cast<Ptype>(s),
PTYPE_EMPTY,
true, attack, defense));
17 push_back(
new Pattern(d, d2, static_cast<Ptype>(s),
PTYPE_EDGE,
true, attack, defense));
22 for (
int x=1; x<=9; ++x) {
23 for (
int y=1; y<=9; ++y) {
58 std::ostringstream ss;
70 std::ostringstream ss;
71 ss <<
"PatLong" << direction_id;
79 for (
int s=0; s<((d == 0) ? 5 : 4); ++s) {
80 const Ptype self = self_list[s];
82 for (
int attack=0; attack<3; ++attack) {
83 for (
int defense=0; defense<3; ++defense) {
85 push_back(
new PatternLong(direction,
self,
LongTarget(static_cast<Ptype>(t),
true,
true, attack, defense)));
86 push_back(
new PatternLong(direction,
self,
LongTarget(static_cast<Ptype>(t),
true,
false, attack, defense)));
87 push_back(
new PatternLong(direction,
self,
LongTarget(static_cast<Ptype>(t),
false,
true, attack, defense)));
88 push_back(
new PatternLong(direction,
self,
LongTarget(static_cast<Ptype>(t),
false,
false, attack, defense)));
109 base += unit*2;
break;
111 base += unit*3;
break;
115 base += unit*4;
break;
123 if (pp.first.isEdge()) {
127 if (pp.first.isEmpty()) {
132 assert(pp.first.isPiece());
135 index += (pp.first.owner() != move.
player());
143 std::ostringstream ss;
152 for (
int s=0; s<((d == 0) ? 5 : 4); ++s) {
153 const Ptype self = self_list[s];
174 base += unit*2;
break;
176 base += unit*3;
break;
180 base += unit*4;
break;
205 for (
int attack=0; attack<3; ++attack) {
206 for (
int defense=0; defense<3; ++defense) {
225 if (pp.first.isEdge())
230 if (pp.first.isEmpty()) {
232 index += ! pp.second.canPromote(
alt(state.
turn()));
235 assert(pp.first.isPiece());
237 index += (! pp.second.canPromote(pp.first.isPiece() ?
alt(pp.first.owner()) :
alt(move.
player())))*2;
238 index += (pp.first.owner() != move.
player());
static bool isPromotable(Move move, Square position)
static std::string name(int direction_id)
constexpr Player alt(Player player)
static const CArray< Direction, 4 > bishop_direction4
static const Square makeDirect(int value)
static const PieceSquare find(const NumEffectState &state, Move move, Ptype attacker_ptype)
CArray2d< unsigned char, 2, Square::SIZE > target_table
const Piece pieceAt(Square sq) const
mutually exclusive set of features
static const Piece EMPTY()
static const Direction INVALID
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
const PtypeTable Ptype_Table
static int index(const NumEffectState &state, Square position, const RatingEnv &env)
const Square from() const
static const PieceSquare find(const NumEffectState &state, Move move, Direction direction)
PatternGroup(Direction d, Direction d2=Pattern::INVALID)
CArray< int, Square::SIZE > pattern_cache
Direction makeDirection(Ptype ptype) const
constexpr int playerToIndex(Player player)
unsigned int index() const
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
static const Piece find(const NumEffectState &state, Move move, Direction direction)
Direction makeDirection(Ptype ptype) const
constexpr bool isPiece(Ptype ptype)
ptypeが空白やEDGEでないかのチェック
std::pair< Piece, Square > PieceSquare
static Square nextSquare(Player player, Square start, Direction direction, Direction direction2)
int findMatch(const NumEffectState &state, Move m, const RatingEnv &) const
static std::string name(Direction direction, Direction direction2)
PatternBase< false > Pattern
PatternBlockGroup(Ptype attacker)
unsigned int uintValue() const
static const CArray< Direction, 4 > rook_direction4
static std::string name(int direction_id)