10 for (
size_t i = 0; i < weights.
dimension(); ++i)
22 const int black_count =
24 const int white_count =
26 for (
int j = 0; j < black_count; ++j)
30 for (
int j = 0; j < white_count; ++j)
46 for (
size_t i = 0; i < weights.
dimension(); ++i)
55 return table[black_count] -
table[white_count];
67 for (
int rook = 0; rook <= indices[0]; ++rook)
69 for (
int bishop = 0; bishop <= indices[1]; ++bishop)
71 for (
int gold = 0; gold <= indices[2]; ++gold)
73 for (
int silver = 0; silver <= indices[3]; ++silver)
75 for (
int knight = 0; knight <= indices[4]; ++knight)
77 for (
int lance = 0; lance <= indices[5]; ++lance)
79 if (rook + bishop + gold + silver + knight + lance == 0)
83 result += values[
index(rook, bishop,
84 gold, silver, knight, lance)];
98 for (
size_t i = 0; i <
ONE_DIM; ++i)
106 for (indices[0] = 0; indices[0] <= 2; ++indices[0])
108 for (indices[1] = 0; indices[1] <= 2; ++indices[1])
110 for (indices[2] = 0; indices[2] <= 4; ++indices[2])
112 for (indices[3] = 0; indices[3] <= 4; ++indices[3])
114 for (indices[4] = 0; indices[4] <= 4; ++indices[4])
116 for (indices[5] = 0; indices[5] <= 4; ++indices[5])
123 indices[5])] =
sumUp(indices, orig_table);
130 table[0] = orig_table[0];
137 for (
size_t i = 0; i <
ONE_DIM; ++i)
145 for (indices[0] = 0; indices[0] <= 2; ++indices[0])
147 for (indices[1] = 0; indices[1] <= 2; ++indices[1])
149 for (indices[2] = 0; indices[2] <= 4; ++indices[2])
151 for (indices[3] = 0; indices[3] <= 4; ++indices[3])
153 for (indices[4] = 0; indices[4] <= 4; ++indices[4])
155 for (indices[5] = 0; indices[5] <= 4; ++indices[5])
191 result =
table[black_index] -
table[white_index];
192 if (can_check[
WHITE])
196 if (can_check[
BLACK])
212 could_check[0] == can_check[0] && could_check[1] == can_check[1])
216 return eval(state, can_check);
225 for (
size_t i = 0; i <
ONE_DIM; ++i)
242 for (
int j = 0; j < black_count; ++j)
249 for (
int j = 0; j < white_count; ++j)
259template<osl::Player P>
265 assert(P==moved.
player());
292 const int index_black =
index(P,
BLACK, ptype, count);
293 const int index_white =
index(P,
WHITE, ptype, count);
314 for (
size_t i = 0; i <
ONE_DIM; ++i)
322 for (
int i=0;i<7;i++){
325 for(
int king_y=1;king_y<=9;king_y++){
327 for(
int count=0;count<=ptypeSize;count++){
329 int oldIndex=(king_y - 1) * 40 +
Ptype_Table.getIndexMin(ptype) + count;
330 int newIndex=(king_y - 1) * 7*19 + i*19 + count;
337 if(count==ptypeSize)
break;
376template<osl::Player P>
391 const int attack_index =
index(ptype, P,
394 const int defense_index =
index(ptype, P,
406 const int attack_index =
index(ptype, P,
409 const int defense_index =
index(ptype, P,
425 for (
size_t i = 0; i <
ONE_DIM; ++i)
427 int low = (i & 0x7F);
431 for (
int s = 0; s <
NStages; ++s)
461 return table[(black_index << 7) | white_index];
Ptype capturePtype() const
static const CArray< Ptype, 7 > order
持駒の表示で良く使われる順番.
bool hasPieceOnStand(Player player, Ptype ptype) const
Square kingSquare() const
int countPiecesOnStand(Player pl, Ptype ptype) const
持駒の枚数を数える
static void setUp(const Weights &weights)
static void setUp(const Weights &weights)
static MultiInt sumUp(const CArray< int, 6 > &indices, const CArray< MultiInt, 5625 > &values)
static CArray< MultiInt, 5625 > check_table
static MultiInt eval(const NumEffectState &state, const CArray< bool, 2 > &can_check)
static CArray< MultiInt, 5625 > table
static MultiInt evalWithUpdate(const NumEffectState &state, Move moved, const MultiInt &last_value, const CArray< bool, 2 > &could_check, const CArray< bool, 2 > &can_check)
static int index(int rook, int bishop, int gold, int silver, int knight, int lance)
static int index(Player player, Player turn, Ptype ptype, int count)
static void setUp(const Weights &weights)
static CArray< MultiInt, 44 > table
static void evalWithUpdateBang(const NumEffectState &state, Move moved, MultiIntPair &last_value_and_out)
static void eval(const NumEffectState &state, MultiIntPair &out)
static void setUp(const Weights &weights, int stage)
static MultiInt eval(int black_count, int white_count)
static CArray< MultiInt, 21 > table
static MultiInt eval(const NumEffectState &state)
static void setUp(const Weights &weights)
static CArray< MultiInt, 16384 > table
static CArray< MultiInt, 360 > y_attack_table
static int index(Ptype ptype, Player player, Square king, int count)
static CArray< MultiInt, 9 *7 *19 > y_attack_table_sum
static void updateResult(NumEffectState const &state, MultiInt &result, int i, Ptype ptype, CArray< Square, 2 > const &kings)
static MultiInt evalWithUpdate(const NumEffectState &state, Move moved, const MultiInt &last_value)
static MultiInt eval(const NumEffectState &state)
static CArray< MultiInt, 9 *7 *19 > y_defense_table_sum
static CArray< MultiInt, 360 > y_defense_table
static void setUp(const Weights &weights)
static CArray< MultiInt, osl::Piece::SIZE > table
static MultiInt eval(const NumEffectState &state)
static void setUp(const Weights &weights, int stage)
const PtypeTable Ptype_Table
Ptype unpromote(Ptype ptype)
ptypeがpromote後の型の時に,promote前の型を返す. promoteしていない型の時はそのまま返す
constexpr Player alt(Player player)
int value(size_t index) const