openMidEndingEval.h
Go to the documentation of this file.
/* openMidEndingEval.h
*/
#ifndef EVAL_ML_OPENMIDENDINGEVAL_H
#define EVAL_ML_OPENMIDENDINGEVAL_H
#include "osl/eval/weights.h"
#include "osl/eval/ptypeEval.h"
#include "osl/eval/evalStagePair.h"
#include "osl/eval/evalTraits.h"
#include "osl/eval/ptypeEval.h"
#include "osl/numEffectState.h"
#include "osl/progress.h"
#include "osl/bits/align16New.h"
#include "osl/oslConfig.h"
#include <cstring>
#define USE_TEST_PROGRESS
// NewProgressが学習可能な場合に定義 (現在はosl側に変更はないので常に定義)
#define LEARN_TEST_PROGRESS
namespace osl
{
namespace eval
{
namespace ml
{
using namespace osl::progress::ml;
class OpenMidEndingPtypeTable : public PtypeEvalTable
{
public:
OpenMidEndingPtypeTable();
};
struct OpenMidEndingEvalDebugInfo
{
enum StageFeature
{
KING_PIECE_RELATIVE,
PIECE_STAND,
KING25_EFFECT_EACH,
PTYPEX,
PTYPEY,
ROOK_MOBILITY,
BISHOP_MOBILITY,
LANCE_MOBILITY,
ROOK_EFFECT,
BISHOP_EFFECT,
PIECE_STAND_COMBINATION,
PIECE_STAND_TURN,
ROOK_PAWN,
PAWN_DROP,
PIECE_STAND_Y,
KNIGHT_CHECK,
PAWN_ADVANCE,
PAWN_PTYPEO,
PROMOTED_MINOR_PIECE,
KING_PIECE_RELATIVE_NOSUPPORT,
NON_PAWN_ATTACKED,
NON_PAWN_ATTACKED_PTYPE,
PTYPE_YY,
KING3PIECES,
BISHOP_HEAD,
KNIGHT_HEAD,
ROOK_PROMOTE_DEFENSE,
PTYPE_COUNT,
LANCE_EFFECT_PIECE,
PTYPE_Y_PAWN_Y,
BISHOP_AND_KING,
PIECE_FORK_TURN,
ROOK_SILVER_KNIGHT,
BISHOP_SILVER_KNIGHT,
KING25_EFFECT_SUPPORTED,
KING_ROOK_BISHOP,
KING_X_BLOCKED3,
GOLD_RETREAT,
SILVER_RETREAT,
ALL_GOLD,
ALL_MAJOR,
KING25_EFFECT_DEFENSE,
ANAGUMA_EMPTY,
NO_PAWN_ON_STAND,
NON_PAWN_PIECE_STAND,
PIN_PTYPE_ALL,
KING_MOBILITY,
GOLD_AND_SILVER_NEAR_KING,
PTYPE_COMBINATION,
KING25_BOTH_SIDE,
KING25_MOBILITY,
BISHOP_STAND_FILE5,
MAJOR_CHECK_WITH_CAPTURE,
SILVER_ADVANCE26,
KING25_EFFECT3,
BISHOP_BISHOP_PIECE,
ROOK_ROOK,
ROOK_ROOK_PIECE,
KING25_EFFECT_COUNT_COMBINATION,
NON_PAWN_ATTACKED_PTYPE_PAIR,
ATTACK_MAJORS_IN_BASE,
STAGE_FEATURE_LIMIT
};
enum ProgressIndependentFeature
{
PIECE,
BISHOP_EXCHANGE_SILVER_KING, // recalculated_value
ENTER_KING_DEFENSE,
KING25_EFFECT_ATTACK, // end recalculated_value
PIECE_PAIR,
PIECE_PAIR_KING,
PROGRESS_INDEPENDENT_FEATURE_LIMIT
};
int value;
int progress;
CArray<int, PROGRESS_INDEPENDENT_FEATURE_LIMIT> progress_independent_values;
CArray<MultiInt, STAGE_FEATURE_LIMIT> stage_values;
static const char *name(ProgressIndependentFeature);
static const char *name(StageFeature);
};
class OpenMidEndingEval
#if OSL_WORDSIZE == 32
: public misc::Align16New
#endif
{
private:
enum { INVALID=EvalTraits<BLACK>::MAX_VALUE+1 };
enum {
ProgressIndependentValueLimit = 4000
};
enum LoadStatus { Zero=0, Loaded, Random };
static volatile LoadStatus initialized_flag;
static Weights piece_pair_weights;
typedef osl::progress::ml::NewProgress progress_t;
progress_t progress;
MultiIntPair kingx_blocked, king25_effect_each;
MultiIntPair king25_both_side,king_rook_bishop;
MultiIntPair piece_stand_turn, non_pawn_attacked,
non_pawn_attacked_ptype, piece_fork_turn;
MultiInt ptypey, ptypex, king_table_value;
MultiInt piece_stand_value, recalculated_stage_value, pawn_advance;
MultiInt rook_mobility, bishop_mobility, lance_mobility;
MultiInt knight_advance, pawn_drop, promoted_minor_piece, rook_pawn,
rook_effect, bishop_effect, bishop_head, nosupport, ptype_yy, king3pieces;
MultiInt rook_promote_defense;
MultiInt piece_stand_combination, piece_stand_y, knight_check,
knight_head, pawn_ptypeo, ptype_count_value, lance_effect_piece,
ptype_y_pawn_y, bishop_and_king, rook_silver_knight, bishop_silver_knight;
CArray<BoardMask, 2> knight_fork_squares;
CArray<PieceMask, 2> effect25; // index: owner of king
CArray<PieceMask, 2> effect25_supported; // index: owner of king
CArray<PieceMask, 2> effected_mask;
CArray<PieceMask, 2> effected_mask_for_attacked;
CArray<PieceMask, 40> attacked_mask;
CArray<int, 5> black_vertical, white_vertical,
black_king_vertical, white_king_vertical;
// flat
CArray<int,2> piece_pair_king_value;
CArray<int, 2> non_pawn_stand_count;
CArray2d<int, 2, 3> gs_near_king_count;
CArray2d<int, 2, PTYPE_SIZE> ptype_count, ptype_board_count;
CArray<std::pair<Square,int>, 2> knight_drop, silver_drop, bishop_drop, rook_drop;
CArray2d<int, 2, 9> pawns;
int progress_independent_value, // should be renamed to piece
recalculated_value, piece_pair_value;
int black_pawn_count;
int black_major_count, black_gold_count;
int black_attack_effect, black_attack_piece,
white_attack_effect, white_attack_piece,
black_attack_supported_piece, white_attack_supported_piece;
int black_defense_effect, black_defense_piece,
white_defense_effect, white_defense_piece;
mutable int cache;
Player turn;
unsigned int ptypeo_mask;
CArray<bool, 2> can_check; // king is defense
bool use_progress_independent_value_limit;
static const int ROUND_UP = 2;
static int roundUp(int v)
{
return v & (~(ROUND_UP-1));
}
void updateGoldSilverNearKing(const NumEffectState &state)
{
const CArray<Square,2> kings = {{
state.kingSquare(BLACK),
state.kingSquare(WHITE),
}};
gs_near_king_count.fill(0);
for (int i = PtypeTraits<GOLD>::indexMin;
i < PtypeTraits<GOLD>::indexLimit; ++i)
{
const Piece p = state.pieceOf(i);
if (p.isOnBoard())
{
const Square pos = p.square();
const int y_diff = std::abs(pos.y() - kings[p.owner()].y());
const int x_diff = std::abs(pos.x() - kings[p.owner()].x());
if (y_diff <= 2 && x_diff <= 3)
{
++gs_near_king_count[p.owner()][std::max(x_diff, y_diff) - 1];
}
}
}
for (int i = PtypeTraits<SILVER>::indexMin;
i < PtypeTraits<SILVER>::indexLimit; ++i)
{
const Piece p = state.pieceOf(i);
if (p.isOnBoard())
{
const Square pos = p.square();
const int y_diff = std::abs(pos.y() - kings[p.owner()].y());
const int x_diff = std::abs(pos.x() - kings[p.owner()].x());
if (y_diff <= 2 && x_diff <= 3)
{
++gs_near_king_count[p.owner()][std::max(x_diff, y_diff) - 1];
}
}
}
}
public:
explicit OpenMidEndingEval
(const NumEffectState &state=NumEffectState(),
bool limit_progress_independent_value=! OslConfig::hasByoyomi());
OpenMidEndingEval& operator=(const OpenMidEndingEval& src)
{
if (this != &src)
memcpy(this, &src, sizeof(OpenMidEndingEval));
return *this;
}
void changeTurn() { }
static bool initialized()
{
return initialized_flag;
}
static bool setUp(const char *filename);
static bool setUp();
static std::string defaultFilename();
int progressIndependentValue() const
{
return progress_independent_value + recalculated_value + piece_pair_value
+ piece_pair_king_value[BLACK] + piece_pair_king_value[WHITE];
}
void debug() const;
MultiInt stageValue() const
{
return king_table_value + piece_stand_value +
king25_effect_each[BLACK] + king25_effect_each[WHITE] +
ptypex + ptypey + rook_mobility + bishop_mobility + lance_mobility +
rook_effect + bishop_effect +
piece_stand_combination + piece_stand_turn[turn] +
rook_pawn + pawn_drop + piece_stand_y + knight_check +
pawn_advance + pawn_ptypeo + promoted_minor_piece +
nosupport +
non_pawn_attacked[turn] + non_pawn_attacked_ptype[turn] +
ptype_yy + king3pieces + bishop_head + knight_head
+ rook_promote_defense +
ptype_count_value + lance_effect_piece + ptype_y_pawn_y +
bishop_and_king + piece_fork_turn[turn] + rook_silver_knight + bishop_silver_knight +
recalculated_stage_value;
}
int openingValue() const
{
return stageValue()[0];
}
int midgameValue() const
{
return stageValue()[1];
}
int midgame2Value() const
{
return stageValue()[2];
}
int endgameValue() const
{
return stageValue()[EndgameIndex];
}
void invalidateCache() { cache=INVALID; }
static int progressIndependentValueAdjusted(int value, int progress,
int progress_max)
{
if (value > ProgressIndependentValueLimit) {
int diff = value - ProgressIndependentValueLimit;
value = ProgressIndependentValueLimit
+ diff * progress/progress_max;
}
else if (value < -ProgressIndependentValueLimit) {
int diff = value + ProgressIndependentValueLimit;
value = -ProgressIndependentValueLimit
+ diff * progress/progress_max;
}
return value;
}
int composeOpenMidEndgame() const
{
const int progress_max = NewProgress::maxProgress(), c = progress_max/2;
const int progress = this->progress.progress();
int progress_independent = use_progress_independent_value_limit
? progressIndependentValueAdjusted
(progressIndependentValue(), progress, progress_max)
: progressIndependentValue();
int sum = progress_independent * progress_max;
if (progress < c)
{
sum += openingValue() * 2*(c - progress);
sum += midgameValue() * 2*progress;
}
else
{
sum += midgameValue() * 2*(progress_max - progress);
sum += endgameValue() * 2*(progress - c);
}
return sum;
}
#ifdef EVAL_QUAD
int composeOpenMid2Endgame() const
{
const int progress_max = NewProgress::maxProgress();
const int progress = this->progress.progress();
const int c0 = progress_max/3, c1 = c0*2;
#ifndef NDEBUG
const int w2 = progress_max - c1;
#endif
assert(c0 == w2);
int progress_independent = use_progress_independent_value_limit
? progressIndependentValueAdjusted
(progressIndependentValue(), progress, progress_max)
: progressIndependentValue();
int sum = progress_independent * c0;
const MultiInt stage_sum = stageValue();
if (progress < c0)
{
sum += stage_sum[0] * (c0 - progress);
sum += stage_sum[1] * progress;
}
else if (progress < c1)
{
sum += stage_sum[1] * (c1 - progress);
sum += stage_sum[2] * (progress-c0);
}
else
{
sum += stage_sum[2] * (progress_max - progress);
sum += stage_sum[3] * (progress - c1);
}
return sum;
}
#endif
int value() const
{
if (cache==INVALID)
{
#ifdef EVAL_QUAD
cache = roundUp(composeOpenMid2Endgame());
#else
cache = roundUp(composeOpenMidEndgame());
#endif
}
return cache;
}
const Move suggestMove(const NumEffectState& state) const
{
assert(turn == state.turn());
Move suggest;
int best_value = 0;
if (! rook_drop[turn].first.isPieceStand()) {
assert(state.hasPieceOnStand(turn, ROOK));
suggest = Move(rook_drop[turn].first, ROOK, turn);
best_value = rook_drop[turn].second;
}
assert(best_value >= 0);
if (bishop_drop[turn].second > best_value) {
assert(! bishop_drop[turn].first.isPieceStand());
assert(state.hasPieceOnStand(turn, BISHOP));
suggest = Move(bishop_drop[turn].first, BISHOP, turn);
best_value = bishop_drop[turn].second;
}
if (silver_drop[turn].second > best_value) {
assert(! silver_drop[turn].first.isPieceStand());
assert(state.hasPieceOnStand(turn, SILVER));
suggest = Move(silver_drop[turn].first, SILVER, turn);
best_value = silver_drop[turn].second;
}
if (knight_drop[turn].second > best_value
&& state.hasPieceOnStand(turn, KNIGHT)) {
assert(! knight_drop[turn].first.isPieceStand());
suggest = Move(knight_drop[turn].first, KNIGHT, turn);
best_value = knight_drop[turn].second;
}
return suggest;
}
int expect(const NumEffectState &state, Move move) const;
template<Player P>
void updateSub(const NumEffectState &new_state, Move last_move);
void update(const NumEffectState &new_state, Move last_move);
const Progress32 progress32() const
{
return Progress32(progress.progress16(BLACK).value()
+ progress.progress16(WHITE).value());
}
const Progress16 progress16() const { return progress.progress16(); }
int progressValue() const { return progress.progress(); }
int progressMax() const { return progress.maxProgress(); }
public:
static int infty()
{
#ifdef EVAL_QUAD
assert(NewProgress::maxProgress() % 3 == 0);
return 57984 * (NewProgress::maxProgress()/3);
#else
return 57984 * NewProgress::maxProgress();
#endif
}
static int captureValue(PtypeO ptypeO) {
assert(isValidPtypeO(ptypeO));
return roundUp((-PieceEval::value(ptypeO) +
PieceEval::value(captured(ptypeO))) * seeScale());
}
static int seeScale() {
#ifdef EVAL_QUAD
assert(NewProgress::maxProgress() % 3 == 0);
return (NewProgress::maxProgress()/3);
#else
return NewProgress::maxProgress();
#endif
}
OpenMidEndingEvalDebugInfo debugInfo(const NumEffectState &state);
static void setRandom();
static void resetWeights(const int *w, size_t length);
static OpenMidEndingPtypeTable Piece_Value;
bool progressIndependentValueLimit() const {
return use_progress_independent_value_limit;
}
private:
template <class Reader>
static void doResetWeights(Reader& reader);
};
}
using ml::OpenMidEndingEval;
}
using eval::OpenMidEndingEval;
}
#endif // EVAL_ML_OPENMIDENDINGEVAL_H
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; coding:utf-8
// ;;; End:
align16New.h
osl::CArray
Definition container.h:20
osl::Move
圧縮していない moveの表現 .
Definition basic_type.h:1052
osl::NumEffectState
利きを持つ局面
Definition numEffectState.h:34
osl::Piece
駒.
Definition basic_type.h:788
osl::Piece::square
const Square square() const
Definition basic_type.h:832
osl::Piece::owner
Player owner() const
Definition basic_type.h:963
osl::Piece::isOnBoard
bool isOnBoard() const
Definition basic_type.h:985
osl::SimpleState::hasPieceOnStand
bool hasPieceOnStand(Player player, Ptype ptype) const
Definition simpleState.h:191
osl::SimpleState::turn
Player turn() const
Definition simpleState.h:220
osl::SimpleState::pieceOf
const Piece pieceOf(int num) const
Definition simpleState.h:76
osl::SimpleState::kingSquare
Square kingSquare() const
Definition simpleState.h:94
osl::Square
Definition basic_type.h:532
osl::Square::y
int y() const
将棋としてのY座標を返す.
Definition basic_type.h:567
osl::Square::x
int x() const
将棋としてのX座標を返す.
Definition basic_type.h:563
osl::eval::PtypeEvalTable::PtypeEvalTable
PtypeEvalTable()
Definition ptypeEval.cc:2
osl::eval::ml::OpenMidEndingEval
Definition openMidEndingEval.h:125
osl::eval::ml::OpenMidEndingEval::ptype_count_value
MultiInt ptype_count_value
Definition openMidEndingEval.h:148
osl::eval::ml::OpenMidEndingEval::seeScale
static int seeScale()
Definition openMidEndingEval.h:420
osl::eval::ml::OpenMidEndingEval::bishop_drop
CArray< std::pair< Square, int >, 2 > bishop_drop
Definition openMidEndingEval.h:163
osl::eval::ml::OpenMidEndingEval::white_attack_supported_piece
int white_attack_supported_piece
Definition openMidEndingEval.h:171
osl::eval::ml::OpenMidEndingEval::black_king_vertical
CArray< int, 5 > black_king_vertical
Definition openMidEndingEval.h:157
osl::eval::ml::OpenMidEndingEval::pawn_ptypeo
MultiInt pawn_ptypeo
Definition openMidEndingEval.h:148
osl::eval::ml::OpenMidEndingEval::can_check
CArray< bool, 2 > can_check
Definition openMidEndingEval.h:177
osl::eval::ml::OpenMidEndingEval::progressIndependentValue
int progressIndependentValue() const
Definition openMidEndingEval.h:240
osl::eval::ml::OpenMidEndingEval::black_attack_supported_piece
int black_attack_supported_piece
Definition openMidEndingEval.h:171
osl::eval::ml::OpenMidEndingEval::black_gold_count
int black_gold_count
Definition openMidEndingEval.h:168
osl::eval::ml::OpenMidEndingEval::midgameValue
int midgameValue() const
Definition openMidEndingEval.h:267
osl::eval::ml::OpenMidEndingEval::promoted_minor_piece
MultiInt promoted_minor_piece
Definition openMidEndingEval.h:144
osl::eval::ml::OpenMidEndingEval::king_table_value
MultiInt king_table_value
Definition openMidEndingEval.h:141
osl::eval::ml::OpenMidEndingEval::use_progress_independent_value_limit
bool use_progress_independent_value_limit
Definition openMidEndingEval.h:178
osl::eval::ml::OpenMidEndingEval::endgameValue
int endgameValue() const
Definition openMidEndingEval.h:275
osl::eval::ml::OpenMidEndingEval::recalculated_value
int recalculated_value
Definition openMidEndingEval.h:166
osl::eval::ml::OpenMidEndingEval::piece_pair_value
int piece_pair_value
Definition openMidEndingEval.h:166
osl::eval::ml::OpenMidEndingEval::ProgressIndependentValueLimit
@ ProgressIndependentValueLimit
one should attack king after when he captured almost all pieces
Definition openMidEndingEval.h:130
osl::eval::ml::OpenMidEndingEval::ptype_yy
MultiInt ptype_yy
Definition openMidEndingEval.h:145
osl::eval::ml::OpenMidEndingEval::white_attack_effect
int white_attack_effect
Definition openMidEndingEval.h:170
osl::eval::ml::OpenMidEndingEval::roundUp
static int roundUp(int v)
Definition openMidEndingEval.h:180
osl::eval::ml::OpenMidEndingEval::king25_effect_each
MultiIntPair king25_effect_each
Definition openMidEndingEval.h:137
osl::eval::ml::OpenMidEndingEval::initialized
static bool initialized()
Definition openMidEndingEval.h:233
osl::eval::ml::OpenMidEndingEval::pawn_drop
MultiInt pawn_drop
Definition openMidEndingEval.h:144
osl::eval::ml::OpenMidEndingEval::bishop_mobility
MultiInt bishop_mobility
Definition openMidEndingEval.h:143
osl::eval::ml::OpenMidEndingEval::ptype_board_count
CArray2d< int, 2, PTYPE_SIZE > ptype_board_count
Definition openMidEndingEval.h:162
osl::eval::ml::OpenMidEndingEval::non_pawn_stand_count
CArray< int, 2 > non_pawn_stand_count
Definition openMidEndingEval.h:160
osl::eval::ml::OpenMidEndingEval::effect25
CArray< PieceMask, 2 > effect25
Definition openMidEndingEval.h:151
osl::eval::ml::OpenMidEndingEval::captureValue
static int captureValue(PtypeO ptypeO)
Definition openMidEndingEval.h:415
osl::eval::ml::OpenMidEndingEval::progress_independent_value
int progress_independent_value
Definition openMidEndingEval.h:165
osl::eval::ml::OpenMidEndingEval::white_defense_piece
int white_defense_piece
Definition openMidEndingEval.h:173
osl::eval::ml::OpenMidEndingEval::stageValue
MultiInt stageValue() const
Definition openMidEndingEval.h:246
osl::eval::ml::OpenMidEndingEval::white_king_vertical
CArray< int, 5 > white_king_vertical
Definition openMidEndingEval.h:157
osl::eval::ml::OpenMidEndingEval::king25_both_side
MultiIntPair king25_both_side
Definition openMidEndingEval.h:138
osl::eval::ml::OpenMidEndingEval::rook_promote_defense
MultiInt rook_promote_defense
Definition openMidEndingEval.h:146
osl::eval::ml::OpenMidEndingEval::bishop_and_king
MultiInt bishop_and_king
Definition openMidEndingEval.h:149
osl::eval::ml::OpenMidEndingEval::LoadStatus
LoadStatus
Definition openMidEndingEval.h:132
osl::eval::ml::OpenMidEndingEval::Loaded
@ Loaded
Definition openMidEndingEval.h:132
osl::eval::ml::OpenMidEndingEval::Zero
@ Zero
Definition openMidEndingEval.h:132
osl::eval::ml::OpenMidEndingEval::Random
@ Random
Definition openMidEndingEval.h:132
osl::eval::ml::OpenMidEndingEval::rook_silver_knight
MultiInt rook_silver_knight
Definition openMidEndingEval.h:149
osl::eval::ml::OpenMidEndingEval::openingValue
int openingValue() const
Definition openMidEndingEval.h:263
osl::eval::ml::OpenMidEndingEval::black_attack_piece
int black_attack_piece
Definition openMidEndingEval.h:169
osl::eval::ml::OpenMidEndingEval::non_pawn_attacked
MultiIntPair non_pawn_attacked
Definition openMidEndingEval.h:139
osl::eval::ml::OpenMidEndingEval::white_attack_piece
int white_attack_piece
Definition openMidEndingEval.h:170
osl::eval::ml::OpenMidEndingEval::piece_stand_value
MultiInt piece_stand_value
Definition openMidEndingEval.h:142
osl::eval::ml::OpenMidEndingEval::ptype_count
CArray2d< int, 2, PTYPE_SIZE > ptype_count
Definition openMidEndingEval.h:162
osl::eval::ml::OpenMidEndingEval::cache
int cache
Definition openMidEndingEval.h:174
osl::eval::ml::OpenMidEndingEval::invalidateCache
void invalidateCache()
Definition openMidEndingEval.h:279
osl::eval::ml::OpenMidEndingEval::ptypey
MultiInt ptypey
Definition openMidEndingEval.h:141
osl::eval::ml::OpenMidEndingEval::bishop_head
MultiInt bishop_head
Definition openMidEndingEval.h:145
osl::eval::ml::OpenMidEndingEval::piece_pair_king_value
CArray< int, 2 > piece_pair_king_value
Definition openMidEndingEval.h:159
osl::eval::ml::OpenMidEndingEval::knight_check
MultiInt knight_check
Definition openMidEndingEval.h:147
osl::eval::ml::OpenMidEndingEval::piece_stand_turn
MultiIntPair piece_stand_turn
Definition openMidEndingEval.h:139
osl::eval::ml::OpenMidEndingEval::midgame2Value
int midgame2Value() const
Definition openMidEndingEval.h:271
osl::eval::ml::OpenMidEndingEval::value
int value() const
Definition openMidEndingEval.h:350
osl::eval::ml::OpenMidEndingEval::OpenMidEndingEval
OpenMidEndingEval(const NumEffectState &state=NumEffectState(), bool limit_progress_independent_value=! OslConfig::hasByoyomi())
Definition openMidEndingEval.cc:499
osl::eval::ml::OpenMidEndingEval::black_defense_effect
int black_defense_effect
Definition openMidEndingEval.h:172
osl::eval::ml::OpenMidEndingEval::rook_effect
MultiInt rook_effect
Definition openMidEndingEval.h:145
osl::eval::ml::OpenMidEndingEval::non_pawn_attacked_ptype
MultiIntPair non_pawn_attacked_ptype
Definition openMidEndingEval.h:140
osl::eval::ml::OpenMidEndingEval::knight_head
MultiInt knight_head
Definition openMidEndingEval.h:148
osl::eval::ml::OpenMidEndingEval::nosupport
MultiInt nosupport
Definition openMidEndingEval.h:145
osl::eval::ml::OpenMidEndingEval::updateGoldSilverNearKing
void updateGoldSilverNearKing(const NumEffectState &state)
Definition openMidEndingEval.h:184
osl::eval::ml::OpenMidEndingEval::lance_mobility
MultiInt lance_mobility
Definition openMidEndingEval.h:143
osl::eval::ml::OpenMidEndingEval::ptypex
MultiInt ptypex
Definition openMidEndingEval.h:141
osl::eval::ml::OpenMidEndingEval::changeTurn
void changeTurn()
Definition openMidEndingEval.h:232
osl::eval::ml::OpenMidEndingEval::progress
progress_t progress
Definition openMidEndingEval.h:136
osl::eval::ml::OpenMidEndingEval::pawn_advance
MultiInt pawn_advance
Definition openMidEndingEval.h:142
osl::eval::ml::OpenMidEndingEval::knight_drop
CArray< std::pair< Square, int >, 2 > knight_drop
Definition openMidEndingEval.h:163
osl::eval::ml::OpenMidEndingEval::composeOpenMidEndgame
int composeOpenMidEndgame() const
Definition openMidEndingEval.h:295
osl::eval::ml::OpenMidEndingEval::rook_mobility
MultiInt rook_mobility
Definition openMidEndingEval.h:143
osl::eval::ml::OpenMidEndingEval::Piece_Value
static OpenMidEndingPtypeTable Piece_Value
Definition openMidEndingEval.h:432
osl::eval::ml::OpenMidEndingEval::ptypeo_mask
unsigned int ptypeo_mask
Definition openMidEndingEval.h:176
osl::eval::ml::OpenMidEndingEval::pawns
CArray2d< int, 2, 9 > pawns
Definition openMidEndingEval.h:164
osl::eval::ml::OpenMidEndingEval::black_defense_piece
int black_defense_piece
Definition openMidEndingEval.h:172
osl::eval::ml::OpenMidEndingEval::black_attack_effect
int black_attack_effect
Definition openMidEndingEval.h:169
osl::eval::ml::OpenMidEndingEval::white_defense_effect
int white_defense_effect
Definition openMidEndingEval.h:173
osl::eval::ml::OpenMidEndingEval::initialized_flag
static volatile LoadStatus initialized_flag
Definition openMidEndingEval.h:133
osl::eval::ml::OpenMidEndingEval::black_pawn_count
int black_pawn_count
Definition openMidEndingEval.h:167
osl::eval::ml::OpenMidEndingEval::bishop_effect
MultiInt bishop_effect
Definition openMidEndingEval.h:145
osl::eval::ml::OpenMidEndingEval::effected_mask
CArray< PieceMask, 2 > effected_mask
Definition openMidEndingEval.h:153
osl::eval::ml::OpenMidEndingEval::kingx_blocked
MultiIntPair kingx_blocked
Definition openMidEndingEval.h:137
osl::eval::ml::OpenMidEndingEval::piece_pair_weights
static Weights piece_pair_weights
Definition openMidEndingEval.h:134
osl::eval::ml::OpenMidEndingEval::progressMax
int progressMax() const
Definition openMidEndingEval.h:404
osl::eval::ml::OpenMidEndingEval::ptype_y_pawn_y
MultiInt ptype_y_pawn_y
Definition openMidEndingEval.h:149
osl::eval::ml::OpenMidEndingEval::gs_near_king_count
CArray2d< int, 2, 3 > gs_near_king_count
Definition openMidEndingEval.h:161
osl::eval::ml::OpenMidEndingEval::infty
static int infty()
Definition openMidEndingEval.h:406
osl::eval::ml::OpenMidEndingEval::piece_fork_turn
MultiIntPair piece_fork_turn
Definition openMidEndingEval.h:140
osl::eval::ml::OpenMidEndingEval::effected_mask_for_attacked
CArray< PieceMask, 2 > effected_mask_for_attacked
Definition openMidEndingEval.h:154
osl::eval::ml::OpenMidEndingEval::progressIndependentValueLimit
bool progressIndependentValueLimit() const
Definition openMidEndingEval.h:433
osl::eval::ml::OpenMidEndingEval::turn
Player turn
Definition openMidEndingEval.h:175
osl::eval::ml::OpenMidEndingEval::attacked_mask
CArray< PieceMask, 40 > attacked_mask
Definition openMidEndingEval.h:155
osl::eval::ml::OpenMidEndingEval::king_rook_bishop
MultiIntPair king_rook_bishop
Definition openMidEndingEval.h:138
osl::eval::ml::OpenMidEndingEval::recalculated_stage_value
MultiInt recalculated_stage_value
Definition openMidEndingEval.h:142
osl::eval::ml::OpenMidEndingEval::INVALID
@ INVALID
Definition openMidEndingEval.h:127
osl::eval::ml::OpenMidEndingEval::ROUND_UP
static const int ROUND_UP
Definition openMidEndingEval.h:179
osl::eval::ml::OpenMidEndingEval::silver_drop
CArray< std::pair< Square, int >, 2 > silver_drop
Definition openMidEndingEval.h:163
osl::eval::ml::OpenMidEndingEval::operator=
OpenMidEndingEval & operator=(const OpenMidEndingEval &src)
Definition openMidEndingEval.h:226
osl::eval::ml::OpenMidEndingEval::black_major_count
int black_major_count
Definition openMidEndingEval.h:168
osl::eval::ml::OpenMidEndingEval::progress16
const Progress16 progress16() const
Definition openMidEndingEval.h:402
osl::eval::ml::OpenMidEndingEval::king3pieces
MultiInt king3pieces
Definition openMidEndingEval.h:145
osl::eval::ml::OpenMidEndingEval::piece_stand_combination
MultiInt piece_stand_combination
Definition openMidEndingEval.h:147
osl::eval::ml::OpenMidEndingEval::progress_t
osl::progress::ml::NewProgress progress_t
Definition openMidEndingEval.h:135
osl::eval::ml::OpenMidEndingEval::rook_drop
CArray< std::pair< Square, int >, 2 > rook_drop
Definition openMidEndingEval.h:163
osl::eval::ml::OpenMidEndingEval::bishop_silver_knight
MultiInt bishop_silver_knight
Definition openMidEndingEval.h:149
osl::eval::ml::OpenMidEndingEval::black_vertical
CArray< int, 5 > black_vertical
Definition openMidEndingEval.h:156
osl::eval::ml::OpenMidEndingEval::knight_advance
MultiInt knight_advance
Definition openMidEndingEval.h:144
osl::eval::ml::OpenMidEndingEval::effect25_supported
CArray< PieceMask, 2 > effect25_supported
Definition openMidEndingEval.h:152
osl::eval::ml::OpenMidEndingEval::progressIndependentValueAdjusted
static int progressIndependentValueAdjusted(int value, int progress, int progress_max)
Definition openMidEndingEval.h:280
osl::eval::ml::OpenMidEndingEval::knight_fork_squares
CArray< BoardMask, 2 > knight_fork_squares
Definition openMidEndingEval.h:150
osl::eval::ml::OpenMidEndingEval::rook_pawn
MultiInt rook_pawn
Definition openMidEndingEval.h:144
osl::eval::ml::OpenMidEndingEval::progressValue
int progressValue() const
Definition openMidEndingEval.h:403
osl::eval::ml::OpenMidEndingEval::lance_effect_piece
MultiInt lance_effect_piece
Definition openMidEndingEval.h:148
osl::eval::ml::OpenMidEndingEval::progress32
const Progress32 progress32() const
Definition openMidEndingEval.h:397
osl::eval::ml::OpenMidEndingEval::piece_stand_y
MultiInt piece_stand_y
Definition openMidEndingEval.h:147
osl::eval::ml::OpenMidEndingEval::white_vertical
CArray< int, 5 > white_vertical
Definition openMidEndingEval.h:156
osl::eval::ml::OpenMidEndingEval::suggestMove
const Move suggestMove(const NumEffectState &state) const
Definition openMidEndingEval.h:362
osl::eval::ml::OpenMidEndingPtypeTable
Definition openMidEndingEval.h:30
osl::eval::ml::OpenMidEndingPtypeTable::OpenMidEndingPtypeTable
OpenMidEndingPtypeTable()
Definition openMidEndingEval.cc:20
osl::eval::ml::PieceEval::value
static int value(PtypeO ptypeO)
Definition ptypeEval.cc:89
osl::progress::ml::NewProgress
Definition progress.h:76
osl::progress::ml::NewProgress::maxProgress
static int maxProgress()
Definition progress.h:243
OSL_WORDSIZE
#define OSL_WORDSIZE
Definition config.h:6
evalStagePair.h
evalTraits.h
osl::progress::ml
Definition progress.cc:756
osl::progress
Definition progress.cc:754
osl::progress::Progress16
ProgressN< 16 > Progress16
Definition progress.h:42
osl::progress::Progress32
ProgressN< 32 > Progress32
Definition progress.h:43
osl
Definition additionalEffect.h:6
osl::ROOK
@ ROOK
Definition basic_type.h:100
osl::BISHOP
@ BISHOP
Definition basic_type.h:99
osl::KNIGHT
@ KNIGHT
Definition basic_type.h:97
osl::SILVER
@ SILVER
Definition basic_type.h:98
osl::CArray2d
CArray< CArray< T, Capacity2 >, Capacity1 > CArray2d
Definition container.h:95
osl::isValidPtypeO
bool isValidPtypeO(int ptypeO)
Definition basic_type.cc:30
osl::EndgameIndex
const int EndgameIndex
Definition midgame.h:16
osl::MultiIntPair
QuadIntPair MultiIntPair
Definition midgame.h:14
osl::MultiInt
QuadInt MultiInt
Definition midgame.h:13
osl::Player
Player
Definition basic_type.h:8
osl::WHITE
@ WHITE
Definition basic_type.h:10
osl::BLACK
@ BLACK
Definition basic_type.h:9
osl::PtypeO
PtypeO
Player + Ptype [-15, 15] PtypeO の O は Owner の O.
Definition basic_type.h:199
osl::captured
PtypeO captured(PtypeO ptypeO)
unpromoteすると共に，ownerを反転する．
Definition basic_type.h:264
numEffectState.h
oslConfig.h
progress.h
ptypeEval.h
osl::OslConfig::hasByoyomi
static bool hasByoyomi()
Definition oslConfig.cc:175
osl::PtypeTraits
Definition ptypeTraits.h:12
osl::eval::EvalTraits
Definition evalTraits.h:13
osl::eval::ml::OpenMidEndingEvalDebugInfo
Definition openMidEndingEval.h:36
osl::eval::ml::OpenMidEndingEvalDebugInfo::progress_independent_values
CArray< int, PROGRESS_INDEPENDENT_FEATURE_LIMIT > progress_independent_values
Definition openMidEndingEval.h:114
osl::eval::ml::OpenMidEndingEvalDebugInfo::value
int value
Definition openMidEndingEval.h:112
osl::eval::ml::OpenMidEndingEvalDebugInfo::stage_values
CArray< MultiInt, STAGE_FEATURE_LIMIT > stage_values
Definition openMidEndingEval.h:115
osl::eval::ml::OpenMidEndingEvalDebugInfo::ProgressIndependentFeature
ProgressIndependentFeature
Definition openMidEndingEval.h:103
osl::eval::ml::OpenMidEndingEvalDebugInfo::PIECE_PAIR_KING
@ PIECE_PAIR_KING
Definition openMidEndingEval.h:109
osl::eval::ml::OpenMidEndingEvalDebugInfo::PROGRESS_INDEPENDENT_FEATURE_LIMIT
@ PROGRESS_INDEPENDENT_FEATURE_LIMIT
Definition openMidEndingEval.h:110
osl::eval::ml::OpenMidEndingEvalDebugInfo::PIECE_PAIR
@ PIECE_PAIR
Definition openMidEndingEval.h:108
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING25_EFFECT_ATTACK
@ KING25_EFFECT_ATTACK
Definition openMidEndingEval.h:107
osl::eval::ml::OpenMidEndingEvalDebugInfo::PIECE
@ PIECE
Definition openMidEndingEval.h:104
osl::eval::ml::OpenMidEndingEvalDebugInfo::ENTER_KING_DEFENSE
@ ENTER_KING_DEFENSE
Definition openMidEndingEval.h:106
osl::eval::ml::OpenMidEndingEvalDebugInfo::BISHOP_EXCHANGE_SILVER_KING
@ BISHOP_EXCHANGE_SILVER_KING
Definition openMidEndingEval.h:105
osl::eval::ml::OpenMidEndingEvalDebugInfo::StageFeature
StageFeature
Definition openMidEndingEval.h:38
osl::eval::ml::OpenMidEndingEvalDebugInfo::NON_PAWN_ATTACKED_PTYPE_PAIR
@ NON_PAWN_ATTACKED_PTYPE_PAIR
Definition openMidEndingEval.h:98
osl::eval::ml::OpenMidEndingEvalDebugInfo::BISHOP_MOBILITY
@ BISHOP_MOBILITY
Definition openMidEndingEval.h:45
osl::eval::ml::OpenMidEndingEvalDebugInfo::BISHOP_BISHOP_PIECE
@ BISHOP_BISHOP_PIECE
Definition openMidEndingEval.h:94
osl::eval::ml::OpenMidEndingEvalDebugInfo::KNIGHT_CHECK
@ KNIGHT_CHECK
Definition openMidEndingEval.h:54
osl::eval::ml::OpenMidEndingEvalDebugInfo::PTYPEY
@ PTYPEY
Definition openMidEndingEval.h:43
osl::eval::ml::OpenMidEndingEvalDebugInfo::PTYPEX
@ PTYPEX
Definition openMidEndingEval.h:42
osl::eval::ml::OpenMidEndingEvalDebugInfo::SILVER_ADVANCE26
@ SILVER_ADVANCE26
Definition openMidEndingEval.h:92
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING_ROOK_BISHOP
@ KING_ROOK_BISHOP
Definition openMidEndingEval.h:74
osl::eval::ml::OpenMidEndingEvalDebugInfo::BISHOP_SILVER_KNIGHT
@ BISHOP_SILVER_KNIGHT
Definition openMidEndingEval.h:72
osl::eval::ml::OpenMidEndingEvalDebugInfo::BISHOP_STAND_FILE5
@ BISHOP_STAND_FILE5
Definition openMidEndingEval.h:90
osl::eval::ml::OpenMidEndingEvalDebugInfo::SILVER_RETREAT
@ SILVER_RETREAT
Definition openMidEndingEval.h:77
osl::eval::ml::OpenMidEndingEvalDebugInfo::ALL_MAJOR
@ ALL_MAJOR
Definition openMidEndingEval.h:79
osl::eval::ml::OpenMidEndingEvalDebugInfo::ROOK_ROOK_PIECE
@ ROOK_ROOK_PIECE
Definition openMidEndingEval.h:96
osl::eval::ml::OpenMidEndingEvalDebugInfo::PTYPE_YY
@ PTYPE_YY
Definition openMidEndingEval.h:61
osl::eval::ml::OpenMidEndingEvalDebugInfo::NON_PAWN_ATTACKED_PTYPE
@ NON_PAWN_ATTACKED_PTYPE
Definition openMidEndingEval.h:60
osl::eval::ml::OpenMidEndingEvalDebugInfo::BISHOP_HEAD
@ BISHOP_HEAD
Definition openMidEndingEval.h:63
osl::eval::ml::OpenMidEndingEvalDebugInfo::LANCE_EFFECT_PIECE
@ LANCE_EFFECT_PIECE
Definition openMidEndingEval.h:67
osl::eval::ml::OpenMidEndingEvalDebugInfo::ROOK_PAWN
@ ROOK_PAWN
Definition openMidEndingEval.h:51
osl::eval::ml::OpenMidEndingEvalDebugInfo::PTYPE_COMBINATION
@ PTYPE_COMBINATION
Definition openMidEndingEval.h:87
osl::eval::ml::OpenMidEndingEvalDebugInfo::PIECE_FORK_TURN
@ PIECE_FORK_TURN
Definition openMidEndingEval.h:70
osl::eval::ml::OpenMidEndingEvalDebugInfo::PROMOTED_MINOR_PIECE
@ PROMOTED_MINOR_PIECE
Definition openMidEndingEval.h:57
osl::eval::ml::OpenMidEndingEvalDebugInfo::LANCE_MOBILITY
@ LANCE_MOBILITY
Definition openMidEndingEval.h:46
osl::eval::ml::OpenMidEndingEvalDebugInfo::PAWN_DROP
@ PAWN_DROP
Definition openMidEndingEval.h:52
osl::eval::ml::OpenMidEndingEvalDebugInfo::ANAGUMA_EMPTY
@ ANAGUMA_EMPTY
Definition openMidEndingEval.h:81
osl::eval::ml::OpenMidEndingEvalDebugInfo::STAGE_FEATURE_LIMIT
@ STAGE_FEATURE_LIMIT
Definition openMidEndingEval.h:100
osl::eval::ml::OpenMidEndingEvalDebugInfo::ROOK_ROOK
@ ROOK_ROOK
Definition openMidEndingEval.h:95
osl::eval::ml::OpenMidEndingEvalDebugInfo::ROOK_EFFECT
@ ROOK_EFFECT
Definition openMidEndingEval.h:47
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING_PIECE_RELATIVE_NOSUPPORT
@ KING_PIECE_RELATIVE_NOSUPPORT
Definition openMidEndingEval.h:58
osl::eval::ml::OpenMidEndingEvalDebugInfo::PIECE_STAND_TURN
@ PIECE_STAND_TURN
Definition openMidEndingEval.h:50
osl::eval::ml::OpenMidEndingEvalDebugInfo::GOLD_AND_SILVER_NEAR_KING
@ GOLD_AND_SILVER_NEAR_KING
Definition openMidEndingEval.h:86
osl::eval::ml::OpenMidEndingEvalDebugInfo::ROOK_MOBILITY
@ ROOK_MOBILITY
Definition openMidEndingEval.h:44
osl::eval::ml::OpenMidEndingEvalDebugInfo::ROOK_SILVER_KNIGHT
@ ROOK_SILVER_KNIGHT
Definition openMidEndingEval.h:71
osl::eval::ml::OpenMidEndingEvalDebugInfo::PAWN_ADVANCE
@ PAWN_ADVANCE
Definition openMidEndingEval.h:55
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING25_EFFECT_DEFENSE
@ KING25_EFFECT_DEFENSE
Definition openMidEndingEval.h:80
osl::eval::ml::OpenMidEndingEvalDebugInfo::KNIGHT_HEAD
@ KNIGHT_HEAD
Definition openMidEndingEval.h:64
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING25_MOBILITY
@ KING25_MOBILITY
Definition openMidEndingEval.h:89
osl::eval::ml::OpenMidEndingEvalDebugInfo::NON_PAWN_ATTACKED
@ NON_PAWN_ATTACKED
Definition openMidEndingEval.h:59
osl::eval::ml::OpenMidEndingEvalDebugInfo::ROOK_PROMOTE_DEFENSE
@ ROOK_PROMOTE_DEFENSE
Definition openMidEndingEval.h:65
osl::eval::ml::OpenMidEndingEvalDebugInfo::BISHOP_EFFECT
@ BISHOP_EFFECT
Definition openMidEndingEval.h:48
osl::eval::ml::OpenMidEndingEvalDebugInfo::ALL_GOLD
@ ALL_GOLD
Definition openMidEndingEval.h:78
osl::eval::ml::OpenMidEndingEvalDebugInfo::PIECE_STAND_COMBINATION
@ PIECE_STAND_COMBINATION
Definition openMidEndingEval.h:49
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING3PIECES
@ KING3PIECES
Definition openMidEndingEval.h:62
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING25_EFFECT_SUPPORTED
@ KING25_EFFECT_SUPPORTED
Definition openMidEndingEval.h:73
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING25_EFFECT_COUNT_COMBINATION
@ KING25_EFFECT_COUNT_COMBINATION
Definition openMidEndingEval.h:97
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING25_EFFECT_EACH
@ KING25_EFFECT_EACH
Definition openMidEndingEval.h:41
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING25_BOTH_SIDE
@ KING25_BOTH_SIDE
Definition openMidEndingEval.h:88
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING_MOBILITY
@ KING_MOBILITY
Definition openMidEndingEval.h:85
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING25_EFFECT3
@ KING25_EFFECT3
Definition openMidEndingEval.h:93
osl::eval::ml::OpenMidEndingEvalDebugInfo::MAJOR_CHECK_WITH_CAPTURE
@ MAJOR_CHECK_WITH_CAPTURE
Definition openMidEndingEval.h:91
osl::eval::ml::OpenMidEndingEvalDebugInfo::PAWN_PTYPEO
@ PAWN_PTYPEO
Definition openMidEndingEval.h:56
osl::eval::ml::OpenMidEndingEvalDebugInfo::PIECE_STAND_Y
@ PIECE_STAND_Y
Definition openMidEndingEval.h:53
osl::eval::ml::OpenMidEndingEvalDebugInfo::PTYPE_Y_PAWN_Y
@ PTYPE_Y_PAWN_Y
Definition openMidEndingEval.h:68
osl::eval::ml::OpenMidEndingEvalDebugInfo::ATTACK_MAJORS_IN_BASE
@ ATTACK_MAJORS_IN_BASE
Definition openMidEndingEval.h:99
osl::eval::ml::OpenMidEndingEvalDebugInfo::NON_PAWN_PIECE_STAND
@ NON_PAWN_PIECE_STAND
Definition openMidEndingEval.h:83
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING_PIECE_RELATIVE
@ KING_PIECE_RELATIVE
Definition openMidEndingEval.h:39
osl::eval::ml::OpenMidEndingEvalDebugInfo::PTYPE_COUNT
@ PTYPE_COUNT
Definition openMidEndingEval.h:66
osl::eval::ml::OpenMidEndingEvalDebugInfo::KING_X_BLOCKED3
@ KING_X_BLOCKED3
Definition openMidEndingEval.h:75
osl::eval::ml::OpenMidEndingEvalDebugInfo::PIECE_STAND
@ PIECE_STAND
Definition openMidEndingEval.h:40
osl::eval::ml::OpenMidEndingEvalDebugInfo::BISHOP_AND_KING
@ BISHOP_AND_KING
Definition openMidEndingEval.h:69
osl::eval::ml::OpenMidEndingEvalDebugInfo::PIN_PTYPE_ALL
@ PIN_PTYPE_ALL
Definition openMidEndingEval.h:84
osl::eval::ml::OpenMidEndingEvalDebugInfo::NO_PAWN_ON_STAND
@ NO_PAWN_ON_STAND
Definition openMidEndingEval.h:82
osl::eval::ml::OpenMidEndingEvalDebugInfo::GOLD_RETREAT
@ GOLD_RETREAT
Definition openMidEndingEval.h:76
osl::eval::ml::OpenMidEndingEvalDebugInfo::name
static const char * name(ProgressIndependentFeature)
Definition openMidEndingEval.cc:32
osl::eval::ml::OpenMidEndingEvalDebugInfo::progress
int progress
Definition openMidEndingEval.h:113
osl::eval::ml::Weights
Definition weights.h:18
osl::misc::Align16New
Definition align16New.h:12
weights.h