#include <moveGenerator.h>
Public Member Functions | |
MoveGenerator () | |
template<class EvalT > | |
void | init (int limit, const SimpleHashRecord *record, const EvalT &, const NumEffectState &, bool in_pv, Move hash_move, bool quiesce=false) |
template<Player P> | |
const MoveLogProb | nextTacticalMove (const SearchState2 &state) |
template<Player P> | |
const MoveLogProb | nextMove (const SearchState2 &state) |
void | registerMove (const NumEffectState &state, Move m) |
killer move など | |
int | triedMoves () const |
const PieceMask & | myPins () const |
void | dump () const |
void | generateAll (Player P, const SearchState2 &state, analyzer::CategoryMoveVector &) |
template<Player P> | |
void | generateAll (const SearchState2 &, MoveLogProbVector &) |
void | generateAll (Player P, const SearchState2 &state, MoveLogProbVector &out) |
const MoveLogProbVector & | generated () const |
template<Player P> | |
void | quiesceCapture (const NumEffectState &, Square) |
Static Public Member Functions | |
static int | captureValue (Ptype) |
static void | initOnce () |
call this before any use of instance of MoveGenerator | |
Private Types | |
enum | State { INITIAL, KING_ESCAPE, TAKE_BACK, BREAK_THREATMATE, CAPTURE, TACTICAL_FINISH, TESUJI, ALL, FINISH } |
typedef void(MoveGenerator::* | generator_t )(const SearchState2 &) |
Private Member Functions | |
template<Player P> | |
const MoveLogProb | nextMoveWithGeneration (const SearchState2 &) |
template<Player P> | |
const MoveLogProb | nextTacticalMoveWithGeneration (const SearchState2 &) |
template<Player P> | |
void | generateKingEscape (const SearchState2 &state) |
template<Player P> | |
void | generateTakeBack (const SearchState2 &state) |
template<Player P> | |
void | generateBreakThreatmate (const SearchState2 &state) |
template<Player P> | |
void | generateCapture (const SearchState2 &state) |
template<Player P> | |
void | generateTesuji (const SearchState2 &state) |
template<Player P> | |
void | generateAllExp (const SearchState2 &state) |
template<Player P> | |
void | generateAll (const SearchState2 &state) |
template<Player P> | |
void | addCapture (const NumEffectState &, const RatingEnv &, const MoveVector &) |
Private Attributes | |
MoveLogProbVector | moves |
int | cur_state |
size_t | cur_index |
const SimpleHashRecord * | record |
int | limit |
int | tried |
MoveMarker | marker |
RatingEnv | env |
Progress32 | progress |
Move | eval_suggestion |
bool | in_quiesce |
bool | in_pv |
Static Private Attributes | |
static const CArray2d < generator_t, 2, FINISH > | Generators |
static const CArray< const char *, FINISH > | GeneratorNames |
Definition at line 53 of file moveGenerator.h.
typedef void(MoveGenerator::* osl::search::MoveGenerator::generator_t)(const SearchState2 &) [private] |
Definition at line 59 of file moveGenerator.h.
enum osl::search::MoveGenerator::State [private] |
INITIAL | |
KING_ESCAPE | |
TAKE_BACK | |
BREAK_THREATMATE | |
CAPTURE | |
TACTICAL_FINISH | |
TESUJI | |
ALL | |
FINISH |
Definition at line 55 of file moveGenerator.h.
Definition at line 150 of file moveGenerator.cc.
void osl::search::MoveGenerator::addCapture | ( | const NumEffectState & | state, |
const RatingEnv & | env, | ||
const MoveVector & | src | ||
) | [private] |
Definition at line 350 of file moveGenerator.cc.
References feature_set(), osl::Move::from(), osl::Move::isDrop(), osl::KING, osl::rating::FeatureSet::logProbSeePlus(), max_see, moves, osl::Move::ptype(), and osl::Move::to().
int osl::search::MoveGenerator::captureValue | ( | Ptype | ptype | ) | [static] |
Definition at line 155 of file moveGenerator.cc.
References osl::eval::PtypeEvalTable::captureValue(), osl::isPiece(), osl::newPtypeO(), osl::eval::Ptype_Eval_Table, result, and osl::WHITE.
void osl::search::MoveGenerator::dump | ( | ) | const |
Definition at line 194 of file moveGenerator.cc.
References moves.
void osl::search::MoveGenerator::generateAll | ( | Player | P, |
const SearchState2 & | state, | ||
analyzer::CategoryMoveVector & | out | ||
) |
Definition at line 487 of file moveGenerator.cc.
References moves, and osl::playerToIndex().
Referenced by osl::search::AlphaBeta2< EvalT >::alphaBetaSearchRoot().
void osl::search::MoveGenerator::generateAll | ( | const SearchState2 & | state, |
MoveLogProbVector & | out | ||
) |
Definition at line 512 of file moveGenerator.cc.
References osl::search::SearchState2Core::state(), and osl::MoveLogProb::validMove().
void osl::search::MoveGenerator::generateAll | ( | Player | P, |
const SearchState2 & | state, | ||
MoveLogProbVector & | out | ||
) |
Definition at line 530 of file moveGenerator.cc.
References osl::BLACK, and out.
void osl::search::MoveGenerator::generateAll | ( | const SearchState2 & | state | ) | [private] |
Definition at line 446 of file moveGenerator.cc.
References osl::alt(), feature_set(), osl::Move::from(), osl::rating::FeatureSet::generateLogProb(), osl::Move::isCaptureOrPromotion(), osl::Move::isDrop(), osl::KING, limit, osl::MoveLogProb::logProb(), osl::eval::min(), osl::MoveLogProb::move(), moves, osl::Move::ptype(), osl::search::SearchState2Core::state(), and osl::Move::to().
void osl::search::MoveGenerator::generateAllExp | ( | const SearchState2 & | state | ) | [private] |
void osl::search::MoveGenerator::generateBreakThreatmate | ( | const SearchState2 & | state | ) | [private] |
Definition at line 284 of file moveGenerator.cc.
References osl::search::BreakThreatmate::generate(), osl::Move::isNormal(), osl::MoveLogProb::move(), moves, and osl::search::SearchState2Core::state().
void osl::search::MoveGenerator::generateCapture | ( | const SearchState2 & | state | ) | [private] |
Definition at line 384 of file moveGenerator.cc.
References osl::search::SearchState2Core::state().
const MoveLogProbVector& osl::search::MoveGenerator::generated | ( | ) | const [inline] |
Definition at line 125 of file moveGenerator.h.
References moves.
void osl::search::MoveGenerator::generateKingEscape | ( | const SearchState2 & | state | ) | [private] |
Definition at line 251 of file moveGenerator.cc.
References osl::alt(), feature_set(), osl::move_generator::capture::generate(), osl::search::SearchState2Core::history(), osl::eval::min(), moves, osl::Piece::square(), osl::search::SearchState2Core::state(), and osl::unpromote().
void osl::search::MoveGenerator::generateTakeBack | ( | const SearchState2 & | state | ) | [private] |
Definition at line 297 of file moveGenerator.cc.
References feature_set(), osl::Move::from(), osl::move_generator::capture::generate(), osl::Move::isDrop(), osl::KING, osl::search::SearchState2Core::lastMove(), osl::rating::FeatureSet::logProbTakeBack(), osl::eval::min(), moves, osl::Move::ptype(), osl::search::SearchState2Core::state(), and osl::Move::to().
void osl::search::MoveGenerator::generateTesuji | ( | const SearchState2 & | state | ) | [private] |
Definition at line 407 of file moveGenerator.cc.
References osl::move_generator::capture::generate(), moves, and osl::search::SearchState2Core::state().
void osl::search::MoveGenerator::init | ( | int | limit, |
const SimpleHashRecord * | record, | ||
const EvalT & | eval, | ||
const NumEffectState & | state, | ||
bool | in_pv, | ||
Move | hash_move, | ||
bool | quiesce = false |
||
) |
Definition at line 167 of file moveGenerator.cc.
References osl::alt(), osl::Move::isNormal(), and moves.
Referenced by osl::search::AlphaBeta2< EvalT >::alphaBetaSearchRoot(), osl::search::AlphaBeta2Tree< EvalT >::nextMove(), osl::search::AlphaBeta2Tree< EvalT >::quiesce(), and osl::search::AlphaBeta2Tree< EvalT >::quiesceRoot().
void osl::search::MoveGenerator::initOnce | ( | ) | [static] |
call this before any use of instance of MoveGenerator
Definition at line 43 of file moveGenerator.cc.
References osl::rating::StandardFeatureSet::instance().
Referenced by osl::search::AlphaBeta2< EvalT >::AlphaBeta2().
const PieceMask& osl::search::MoveGenerator::myPins | ( | ) | const [inline] |
Definition at line 115 of file moveGenerator.h.
References env.
const MoveLogProb osl::search::MoveGenerator::nextMove | ( | const SearchState2 & | state | ) | [inline] |
Definition at line 93 of file moveGenerator.h.
References cur_index, cur_state, FINISH, moves, TACTICAL_FINISH, and tried.
Referenced by osl::search::AlphaBeta2Tree< EvalT >::nextMove(), osl::search::AlphaBeta2Tree< EvalT >::quiesce(), and osl::search::AlphaBeta2Tree< EvalT >::quiesceRoot().
template const MoveLogProb osl::search::MoveGenerator::nextMoveWithGeneration< WHITE > | ( | const SearchState2 & | ) | [private] |
Definition at line 231 of file moveGenerator.cc.
References moves, and osl::playerToIndex().
const MoveLogProb osl::search::MoveGenerator::nextTacticalMove | ( | const SearchState2 & | state | ) | [inline] |
P | turn |
Definition at line 83 of file moveGenerator.h.
References cur_index, cur_state, moves, TACTICAL_FINISH, and tried.
Referenced by osl::search::AlphaBeta2Tree< EvalT >::nextMove(), osl::search::AlphaBeta2Tree< EvalT >::quiesce(), and osl::search::AlphaBeta2Tree< EvalT >::quiesceRoot().
template const MoveLogProb osl::search::MoveGenerator::nextTacticalMoveWithGeneration< WHITE > | ( | const SearchState2 & | ) | [private] |
Definition at line 207 of file moveGenerator.cc.
References moves, and osl::playerToIndex().
void osl::search::MoveGenerator::quiesceCapture | ( | const NumEffectState & | state, |
Square | to | ||
) |
Definition at line 428 of file moveGenerator.cc.
References osl::move_generator::capture::generate(), max_see, and moves.
void osl::search::MoveGenerator::registerMove | ( | const NumEffectState & | state, |
Move | m | ||
) | [inline] |
killer move など
Definition at line 106 of file moveGenerator.h.
References osl::Move::isNormal(), marker, osl::search::MoveMarker::registerMove(), and tried.
int osl::search::MoveGenerator::triedMoves | ( | ) | const [inline] |
Definition at line 114 of file moveGenerator.h.
References tried.
size_t osl::search::MoveGenerator::cur_index [private] |
Definition at line 64 of file moveGenerator.h.
Referenced by nextMove(), and nextTacticalMove().
int osl::search::MoveGenerator::cur_state [private] |
Definition at line 63 of file moveGenerator.h.
Referenced by nextMove(), and nextTacticalMove().
RatingEnv osl::search::MoveGenerator::env [private] |
Definition at line 69 of file moveGenerator.h.
Referenced by myPins().
Definition at line 71 of file moveGenerator.h.
const CArray< const char *, MoveGenerator::FINISH > osl::search::MoveGenerator::GeneratorNames [static, private] |
{{ "INITIAL", "KING_ESCAPE", "TAKEBACK", "BREAK_THREATMATE", "TACTICAL", "SENTINEL", "TESUJI", "ALL", }}
Definition at line 61 of file moveGenerator.h.
const CArray2d< MoveGenerator::generator_t, 2, MoveGenerator::FINISH > osl::search::MoveGenerator::Generators [static, private] |
{{ { 0, &MoveGenerator::generateKingEscape<BLACK>, &MoveGenerator::generateTakeBack<BLACK>, &MoveGenerator::generateBreakThreatmate<BLACK>, &MoveGenerator::generateCapture<BLACK>, 0, &MoveGenerator::generateTesuji<BLACK>, &MoveGenerator::generateAll<BLACK>, }, { 0, &MoveGenerator::generateKingEscape<WHITE>, &MoveGenerator::generateTakeBack<WHITE>, &MoveGenerator::generateBreakThreatmate<WHITE>, &MoveGenerator::generateCapture<WHITE>, 0, &MoveGenerator::generateTesuji<WHITE>, &MoveGenerator::generateAll<WHITE>, } }}
Definition at line 60 of file moveGenerator.h.
bool osl::search::MoveGenerator::in_pv [private] |
Definition at line 75 of file moveGenerator.h.
bool osl::search::MoveGenerator::in_quiesce [private] |
Definition at line 73 of file moveGenerator.h.
int osl::search::MoveGenerator::limit [private] |
Definition at line 66 of file moveGenerator.h.
MoveMarker osl::search::MoveGenerator::marker [private] |
Definition at line 68 of file moveGenerator.h.
Referenced by registerMove().
MoveLogProbVector osl::search::MoveGenerator::moves [private] |
Definition at line 62 of file moveGenerator.h.
Referenced by generated(), nextMove(), and nextTacticalMove().
Progress32 osl::search::MoveGenerator::progress [private] |
Definition at line 70 of file moveGenerator.h.
const SimpleHashRecord* osl::search::MoveGenerator::record [private] |
Definition at line 65 of file moveGenerator.h.
int osl::search::MoveGenerator::tried [private] |
Definition at line 67 of file moveGenerator.h.
Referenced by nextMove(), nextTacticalMove(), registerMove(), and triedMoves().