12 for (
size_t i=0; i<weights.
dimension(); ++i)
15 for (
int x=1; x<=5; ++x)
17 for (
int y=1; y<=3; ++y)
21 for (
int i=0; i<45*7; ++i)
22 for (
int j=i+1; j<45*7; ++j)
37template <osl::Player King>
42 if (state.template kingSquare<King>().template squareForBlack<King>().y() < 7)
47 while (! bitset.
none())
58 for (
size_t i=0; i<pieces.
size(); ++i)
60 const unsigned int i0 =
indexPiece<true>(King, pieces[i].square(), pieces[i].ptype());
61 for (
size_t j=i+1; j<pieces.
size(); ++j)
63 const unsigned int i1 =
indexPiece<true>(King, pieces[j].square(), pieces[j].ptype());
64 const unsigned int index =
composeIndex(index_king, i0, i1);
71 for (
size_t i=0; i<pieces.
size(); ++i)
73 const unsigned int i0 =
indexPiece<false>(King, pieces[i].square(), pieces[i].ptype());
74 for (
size_t j=i+1; j<pieces.
size(); ++j)
76 const unsigned int i1 =
indexPiece<false>(King, pieces[j].square(), pieces[j].ptype());
77 const unsigned int index =
composeIndex(index_king, i0, i1);
82 return (King ==
BLACK) ? sum : -sum;
85template <osl::Player King>
91 const int index_king =
indexKing(King, king, flipx);
99 while (! bitset.
none())
105 const unsigned int index =
composeIndex(index_king, i0, i1);
112 while (! bitset.
none())
118 const unsigned int index =
composeIndex(index_king, i0, i1);
123 return (King ==
BLACK) ? sum : -sum;
125template <osl::Player King>
131 const int index_king =
indexKing(King, king, flipx);
138 while (! bitset.
none())
144 const unsigned int index =
composeIndex(index_king, i0, i1);
151 while (! bitset.
none())
157 const unsigned int index =
composeIndex(index_king, i0, i1);
161 return (King ==
BLACK) ? sum : -sum;
163template <osl::Player King>
169 const int index_king =
indexKing(King, king, flipx);
179 while (! bitset.
none())
185 const unsigned int index =
composeIndex(index_king, i0, i1);
187 const unsigned int sub_index =
composeIndex(index_king, s0, i1);
188 sum -=
table[sub_index];
195 while (! bitset.
none())
201 const unsigned int index =
composeIndex(index_king, i0, i1);
203 const unsigned int sub_index =
composeIndex(index_king, s0, i1);
204 sum -=
table[sub_index];
209 return (King ==
BLACK) ? sum : -sum;
212template <osl::Player P>
216 assert(P == moved.
player());
227 adjust_capture = roking.
y() >= 7;
void push_back(const T &e)
Ptype capturePtype() const
Ptype oldPtype() const
移動前のPtype, i.e., 成る手だった場合成る前
const Square from() const
const PieceMask & piecesOnBoard(Player p) const
void clearBit()
unpromote(PTYPE) の駒のbit を消す
const Square square() const
const Piece pieceOf(int num) const
Square kingSquare() const
int y() const
将棋としてのY座標を返す.
const Square squareForBlack(Player player) const
static int add(const NumEffectState &state, Square to, Ptype ptype)
static void setUp(const Weights &weights)
static int addSub(const NumEffectState &state, Square to, Ptype ptype, Square from)
static void evalWithUpdateBang(const NumEffectState &state, Move moved, CArray< int, 2 > &last_value)
static int composeIndex(int king, int i0, int i1)
static int evalOne(const NumEffectState &)
static osl::CArray< int16_t, ONE_DIM > table
static int sub(const NumEffectState &state, Square from, Ptype ptype)
static int indexKing(Player owner, Square king, bool &flipx)
static CArray< int, 2 > eval(const NumEffectState &)
static int indexPiece(Player owner, Square position, Ptype ptype)
bool isPromoted(Ptype ptype)
ptypeがpromote後の型かどうかのチェック
constexpr Player alt(Player player)
PtypeO captured(PtypeO ptypeO)
unpromoteすると共に,ownerを反転する.
int value(size_t index) const