Go to the documentation of this file.
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 Piece pieceAt(Square sq) const
int findMatch(const NumEffectState &state, Move m, const RatingEnv &) const
static const PieceSquare find(const NumEffectState &state, Move move, Direction direction)
constexpr Player alt(Player player)
static std::string name(Direction direction, Direction direction2)
PatternGroup(Direction d, Direction d2=Pattern::INVALID)
Direction makeDirection(Ptype ptype) const
static const Piece EMPTY()
mutually exclusive set of features
static const Piece find(const NumEffectState &state, Move move, Direction direction)
static const CArray< Direction, 4 > rook_direction4
PatternBase< false > Pattern
CArray2d< unsigned char, 2, Square::SIZE > target_table
const PtypeTable Ptype_Table
static std::string name(int direction_id)
unsigned int uintValue() const
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
unsigned int index() const
static std::string name(int direction_id)
static bool isPromotable(Move move, Square position)
Direction makeDirection(Ptype ptype) const
static int index(const NumEffectState &state, Square position, const RatingEnv &env)
static Square nextSquare(Player player, Square start, Direction direction, Direction direction2)
CArray< int, Square::SIZE > pattern_cache
const Square from() const
constexpr int playerToIndex(Player player)
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
std::pair< Piece, Square > PieceSquare
constexpr bool isPiece(Ptype ptype)
ptypeが空白やEDGEでないかのチェック
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
static const Direction INVALID
static const Square makeDirect(int value)
static const PieceSquare find(const NumEffectState &state, Move move, Ptype attacker_ptype)
static const CArray< Direction, 4 > bishop_direction4
PatternBlockGroup(Ptype attacker)