4#ifndef EVAL_ML_OPENMIDENDINGEVAL_H
5#define EVAL_ML_OPENMIDENDINGEVAL_H
18#define USE_TEST_PROGRESS
20#define LEARN_TEST_PROGRESS
192 i < PtypeTraits<GOLD>::indexLimit; ++i)
198 const int y_diff = std::abs(pos.
y() - kings[p.
owner()].y());
199 const int x_diff = std::abs(pos.
x() - kings[p.
owner()].x());
200 if (y_diff <= 2 && x_diff <= 3)
207 i < PtypeTraits<SILVER>::indexLimit; ++i)
213 const int y_diff = std::abs(pos.
y() - kings[p.
owner()].y());
214 const int x_diff = std::abs(pos.
x() - kings[p.
owner()].x());
215 if (y_diff <= 2 && x_diff <= 3)
237 static bool setUp(
const char *filename);
239 static std::string defaultFilename();
298 const int progress = this->progress.progress();
303 int sum = progress_independent * progress_max;
317 int composeOpenMid2Endgame()
const
320 const int progress = this->progress.progress();
321 const int c0 = progress_max/3, c1 = c0*2;
323 const int w2 = progress_max - c1;
326 int progress_independent = use_progress_independent_value_limit
327 ? progressIndependentValueAdjusted
328 (progressIndependentValue(),
progress, progress_max)
329 : progressIndependentValue();
330 int sum = progress_independent * c0;
331 const MultiInt stage_sum = stageValue();
334 sum += stage_sum[0] * (c0 -
progress);
339 sum += stage_sum[1] * (c1 -
progress);
340 sum += stage_sum[2] * (
progress-c0);
344 sum += stage_sum[2] * (progress_max -
progress);
345 sum += stage_sum[3] * (
progress - c1);
372 assert(best_value >= 0);
430 static void setRandom();
431 static void resetWeights(
const int *w,
size_t length);
437 template <
class Reader>
438 static void doResetWeights(Reader& reader);
441 using ml::OpenMidEndingEval;
const Square square() const
bool hasPieceOnStand(Player player, Ptype ptype) const
const Piece pieceOf(int num) const
Square kingSquare() const
int y() const
将棋としてのY座標を返す.
int x() const
将棋としてのX座標を返す.
MultiInt ptype_count_value
CArray< std::pair< Square, int >, 2 > bishop_drop
int white_attack_supported_piece
CArray< int, 5 > black_king_vertical
CArray< bool, 2 > can_check
int progressIndependentValue() const
int black_attack_supported_piece
MultiInt promoted_minor_piece
MultiInt king_table_value
bool use_progress_independent_value_limit
@ ProgressIndependentValueLimit
one should attack king after when he captured almost all pieces
static int roundUp(int v)
MultiIntPair king25_effect_each
static bool initialized()
CArray2d< int, 2, PTYPE_SIZE > ptype_board_count
CArray< int, 2 > non_pawn_stand_count
CArray< PieceMask, 2 > effect25
static int captureValue(PtypeO ptypeO)
int progress_independent_value
MultiInt stageValue() const
CArray< int, 5 > white_king_vertical
MultiIntPair king25_both_side
MultiInt rook_promote_defense
MultiInt rook_silver_knight
MultiIntPair non_pawn_attacked
MultiInt piece_stand_value
CArray2d< int, 2, PTYPE_SIZE > ptype_count
CArray< int, 2 > piece_pair_king_value
MultiIntPair piece_stand_turn
int midgame2Value() const
OpenMidEndingEval(const NumEffectState &state=NumEffectState(), bool limit_progress_independent_value=! OslConfig::hasByoyomi())
MultiIntPair non_pawn_attacked_ptype
void updateGoldSilverNearKing(const NumEffectState &state)
CArray< std::pair< Square, int >, 2 > knight_drop
int composeOpenMidEndgame() const
static OpenMidEndingPtypeTable Piece_Value
CArray2d< int, 2, 9 > pawns
static volatile LoadStatus initialized_flag
CArray< PieceMask, 2 > effected_mask
MultiIntPair kingx_blocked
static Weights piece_pair_weights
CArray2d< int, 2, 3 > gs_near_king_count
MultiIntPair piece_fork_turn
CArray< PieceMask, 2 > effected_mask_for_attacked
bool progressIndependentValueLimit() const
CArray< PieceMask, 40 > attacked_mask
MultiIntPair king_rook_bishop
MultiInt recalculated_stage_value
static const int ROUND_UP
CArray< std::pair< Square, int >, 2 > silver_drop
OpenMidEndingEval & operator=(const OpenMidEndingEval &src)
const Progress16 progress16() const
MultiInt piece_stand_combination
osl::progress::ml::NewProgress progress_t
CArray< std::pair< Square, int >, 2 > rook_drop
MultiInt bishop_silver_knight
CArray< int, 5 > black_vertical
CArray< PieceMask, 2 > effect25_supported
static int progressIndependentValueAdjusted(int value, int progress, int progress_max)
CArray< BoardMask, 2 > knight_fork_squares
int progressValue() const
MultiInt lance_effect_piece
const Progress32 progress32() const
CArray< int, 5 > white_vertical
const Move suggestMove(const NumEffectState &state) const
OpenMidEndingPtypeTable()
static int value(PtypeO ptypeO)
ProgressN< 16 > Progress16
ProgressN< 32 > Progress32
CArray< CArray< T, Capacity2 >, Capacity1 > CArray2d
bool isValidPtypeO(int ptypeO)
PtypeO
Player + Ptype [-15, 15] PtypeO の O は Owner の O.
PtypeO captured(PtypeO ptypeO)
unpromoteすると共に,ownerを反転する.
CArray< int, PROGRESS_INDEPENDENT_FEATURE_LIMIT > progress_independent_values
CArray< MultiInt, STAGE_FEATURE_LIMIT > stage_values
ProgressIndependentFeature
@ PROGRESS_INDEPENDENT_FEATURE_LIMIT
@ BISHOP_EXCHANGE_SILVER_KING
@ NON_PAWN_ATTACKED_PTYPE_PAIR
@ NON_PAWN_ATTACKED_PTYPE
@ KING_PIECE_RELATIVE_NOSUPPORT
@ GOLD_AND_SILVER_NEAR_KING
@ PIECE_STAND_COMBINATION
@ KING25_EFFECT_SUPPORTED
@ KING25_EFFECT_COUNT_COMBINATION
@ MAJOR_CHECK_WITH_CAPTURE
static const char * name(ProgressIndependentFeature)