4 #ifndef EVAL_ML_KING8_H
5 #define EVAL_ML_KING8_H
23 enum {
DIM = 32 + 32 + 288 + 288 };
44 static void effectState(
const NumEffectState &state,
65 template <
class MakeEffectState>
67 template <
class MakeEffectState>
69 const CArray<int,2>& last_value,
const table_t&);
71 template <
class MakeEffectState>
72 static std::pair<CArray<int,2>, CArray<int,2> >
74 const CArray<int,2>& last_value_opening,
const CArray<int,2>& last_value_ending,
77 struct MakeEffectStateSimple;
78 struct MakeEffectStateDefense;
82 return dir * 4 + state;
85 class King8EffectEmptySquareBoth;
86 template <
bool Opening>
95 const CArray<int,2>& last_value);
101 static std::pair<CArray<int,2>, CArray<int,2> >
103 const CArray<int,2>& last_value_opening,
104 const CArray<int,2>& last_value_ending);
116 template <
bool Opening>
126 const CArray<int,2>& last_value);
131 static std::pair<CArray<int,2>, CArray<int,2> >
133 const CArray<int,2>& last_value_opening,
134 const CArray<int,2>& last_value_ending);
173 PieceMask black_mask, PieceMask white_mask);
174 static void effectState(
const NumEffectState &state,
188 template <osl::Player P>
190 template <osl::Player P>
191 static bool isBlocked(
const NumEffectState &state,
194 static std::pair<CArray<int,2>,CArray<int,2> >
195 evalWithUpdate(
const NumEffectState &new_state,
Move last_move,
196 const CArray<int,2>& last_value_o,
197 const CArray<int,2>& last_value_e,
227 template <osl::Player P>
264 static CArray<MultiInt, ONE_DIM>
table;
267 const int x = king.
x();
268 return (x > 5 ? 9 - x : x - 1);;
273 const int x = king.
x();
274 const int y = (P ==
BLACK ? king.
y() : 10 - king.
y());
275 return (y - 1) * 5 + (x > 5 ? 9 - x : x - 1);
289 static CArray<MultiInt, ONE_DIM>
table;
310 bool u_blocked,
bool opp_u_blocked,
bool opp_blocked)
321 else if (P ==
WHITE && x <= 4)
325 return x - 1 + 5 * ((is_l ? 1 : 0) + 2 * ((u_blocked ? 1 : 0) + 2 * ((opp_u_blocked ? 1 : 0) +2 * (opp_blocked ? 1 : 0))));
329 bool u_blocked,
bool opp_u_blocked,
333 const int y = (P ==
BLACK ? king.
y() : 10 - king.
y());
342 else if (P ==
WHITE && x <= 4)
346 return x - 1 + 5 * (y - 1 + 9 * ((is_l ? 1 : 0) + 2 * ((u_blocked ? 1 : 0) + 2 * ((opp_u_blocked ? 1 : 0) + 2 * (opp_blocked ? 1 : 0)))));
366 template <osl::Player Defense>
375 #endif // EVAL_ML_KING8_H