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));
22 for (
int x=1; x<=9; ++x) {
23 for (
int y=1; y<=9; ++y) {
58 std::ostringstream ss;
59 ss <<
"Pattern" << direction;
70 std::ostringstream ss;
71 ss <<
"PatLong" << direction_id;
76 :
Group(name(d)), direction_id(d)
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) {
109 base += unit*2;
break;
111 base += unit*3;
break;
113 if (direction_id != 0)
115 base += unit*4;
break;
119 const Direction direction = makeDirection(self);
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;
144 ss <<
"PatLong2" << direction_id;
149 :
Group(name(d)), direction_id(d)
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;
178 if (direction_id != 0)
180 base += unit*4;
break;
184 const Direction direction = makeDirection(self);
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());
const Square from() const
static const Piece EMPTY()
const Piece pieceAt(Square sq) const
unsigned int index() const
unsigned int uintValue() const
static const Square makeDirect(int value)
mutually exclusive set of features
PatternBlockGroup(Ptype attacker)
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
static const PieceSquare find(const NumEffectState &state, Move move, Ptype attacker_ptype)
static const Piece find(const NumEffectState &state, Move move, Direction direction)
static std::string name(int direction_id)
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
Direction makeDirection(Ptype ptype) const
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
Direction makeDirection(Ptype ptype) const
static const CArray< Direction, 4 > bishop_direction4
static const CArray< Direction, 4 > rook_direction4
static std::string name(int direction_id)
static const PieceSquare find(const NumEffectState &state, Move move, Direction direction)
static Square nextSquare(Player player, Square start, Direction direction, Direction direction2)
static const Direction INVALID
CArray< int, Square::SIZE > pattern_cache
std::pair< Piece, Square > PieceSquare
const PtypeTable Ptype_Table
constexpr int playerToIndex(Player player)
constexpr bool isPiece(Ptype ptype)
ptypeが空白やEDGEでないかのチェック
constexpr Player alt(Player player)
static int index(const NumEffectState &state, Square position, const RatingEnv &env)
static bool isPromotable(Move move, Square position)
CArray2d< unsigned char, 2, Square::SIZE > target_table
int findMatch(const NumEffectState &state, Move m, const RatingEnv &) const
PatternGroup(Direction d, Direction d2=Pattern::INVALID)
static std::string name(Direction direction, Direction direction2)