一般用詰み探索: 先手後手の詰みを別々に管理 More...
#include <dualDfpn.h>
Public Member Functions | |
DualDfpn (uint64_t ignored=std::numeric_limits< uint64_t >::max()) | |
DualDfpn (const DualDfpn &src) | |
~DualDfpn () | |
void | setRootPlayer (Player) |
template<Player P> | |
ProofDisproof | findProof (int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move &best_move, Move last_move=Move::INVALID()) |
template<Player P> | |
bool | isWinningState (int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move &best_move, Move last_move=Move::INVALID()) |
詰みを発見. More... | |
bool | isWinningState (int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move &best_move, Move last_move=Move::INVALID()) |
ProofDisproof | findProof (int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move &best_move, Move last_move=Move::INVALID()) |
template<Player P> | |
bool | isLosingState (int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move last_move=Move::INVALID()) |
bool | isLosingState (int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move last_move=Move::INVALID()) |
void | runGC (bool verbose=false, size_t memory_use_ratio_1000=0) |
void | setVerbose (int level=1) |
int | distance (Player attack, const HashKey &key) |
size_t | mainNodeCount () const |
size_t | totalNodeCount () const |
void | writeRootHistory (const RepetitionCounter &counter, const MoveStack &moves, const SimpleState &state, Player attack) |
const DfpnTable & | table (Player) const |
template<osl::Player P> | |
osl::ProofDisproof | findProof (int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move &best_move, Move last_move) |
Private Member Functions | |
Dfpn & | prepareDfpn (Player attack) |
Dfpn & | prepareDfpnSmall (Player attack) |
Private Attributes | |
std::shared_ptr< Shared > | shared |
std::unique_ptr< Local > | local |
一般用詰み探索: 先手後手の詰みを別々に管理
Definition at line 28 of file dualDfpn.h.
|
explicit |
Definition at line 264 of file dualDfpn.cc.
Referenced by checkmate::DualDfpn::Local::~Local().
osl::checkmate::DualDfpn::DualDfpn | ( | const DualDfpn & | src | ) |
Definition at line 270 of file dualDfpn.cc.
References ~DualDfpn().
osl::checkmate::DualDfpn::~DualDfpn | ( | ) |
Definition at line 614 of file dualDfpn.cc.
References osl::checkmate::Dfpn::distance(), mainNodeCount(), prepareDfpn(), and shared.
Referenced by isWinningState(), and setVerbose().
ProofDisproof osl::checkmate::DualDfpn::findProof | ( | int | node_limit, |
const NumEffectState & | state, | ||
const HashKey & | key, | ||
const PathEncoding & | path, | ||
Move & | best_move, | ||
Move | last_move = Move::INVALID() |
||
) |
Referenced by findProof(), isWinningState(), and runGC().
template ProofDisproof osl::checkmate::DualDfpn::findProof< WHITE > | ( | int | node_limit, |
const NumEffectState & | state, | ||
const HashKey & | key, | ||
const PathEncoding & | path, | ||
Move & | best_move, | ||
Move | last_move = Move::INVALID() |
||
) |
Definition at line 480 of file dualDfpn.cc.
References osl::BLACK, isWinningState(), and osl::SimpleState::turn().
osl::ProofDisproof osl::checkmate::DualDfpn::findProof | ( | int | node_limit, |
const NumEffectState & | state, | ||
const HashKey & | key, | ||
const PathEncoding & | path, | ||
Move & | best_move, | ||
Move | last_move | ||
) |
Definition at line 378 of file dualDfpn.cc.
References osl::stat::Ratio::add(), osl::BLACK, osl::hash::HashKey128::blackStand(), findProof(), osl::checkmate::Dfpn::hasCheckmateMove(), osl::NumEffectState::inCheck(), osl::checkmate::ProofDisproof::isCheckmateSuccess(), osl::checkmate::ProofDisproof::isFinal(), osl::checkmate::ProofDisproof::isLoopDetection(), osl::Move::isNormal(), local, local_table_growth_limit, osl::checkmate::ProofDisproof::LoopDetection(), osl::checkmate::Dfpn::nodeCount(), prepareDfpn(), prepareDfpnSmall(), SCOPED_LOCK, shared, osl::SimpleState::turn(), and osl::WHITE.
bool osl::checkmate::DualDfpn::isLosingState | ( | int | node_limit, |
const NumEffectState & | state, | ||
const HashKey & | key, | ||
const PathEncoding & | path, | ||
Move | last_move = Move::INVALID() |
||
) |
Definition at line 551 of file dualDfpn.cc.
References osl::alt(), osl::checkmate::ProofDisproof::isCheckmateSuccess(), local, prepareDfpn(), shared, and osl::SimpleState::turn().
Referenced by isWinningState().
template bool osl::checkmate::DualDfpn::isLosingState< WHITE > | ( | int | node_limit, |
const NumEffectState & | state, | ||
const HashKey & | key, | ||
const PathEncoding & | path, | ||
Move | last_move = Move::INVALID() |
||
) |
Definition at line 566 of file dualDfpn.cc.
References osl::BLACK, osl::SimpleState::turn(), and writeRootHistory().
|
inline |
詰みを発見.
別々のスレッドから呼び出し可能
Definition at line 51 of file dualDfpn.h.
References distance(), findProof(), osl::Move::INVALID(), osl::checkmate::ProofDisproof::isCheckmateSuccess(), isLosingState(), mainNodeCount(), prepareDfpn(), prepareDfpnSmall(), runGC(), setVerbose(), table(), totalNodeCount(), and writeRootHistory().
Referenced by findProof().
bool osl::checkmate::DualDfpn::isWinningState | ( | int | node_limit, |
const NumEffectState & | state, | ||
const HashKey & | key, | ||
const PathEncoding & | path, | ||
Move & | best_move, | ||
Move | last_move = Move::INVALID() |
||
) |
Definition at line 491 of file dualDfpn.cc.
References osl::BLACK, osl::OslConfig::concurrency(), findProof(), osl::checkmate::ProofDisproof::isCheckmateSuccess(), osl::checkmate::ProofDisproof::isLoopDetection(), isLosingState(), osl::Move::isNormal(), local, osl::eval::min(), shared, and osl::SimpleState::turn().
size_t osl::checkmate::DualDfpn::mainNodeCount | ( | ) | const |
Definition at line 621 of file dualDfpn.cc.
References shared, and totalNodeCount().
Referenced by distance(), and isWinningState().
|
private |
Definition at line 281 of file dualDfpn.cc.
References local, prepareDfpnSmall(), and shared.
Referenced by distance(), findProof(), isLosingState(), isWinningState(), writeRootHistory(), and ~DualDfpn().
|
private |
Definition at line 293 of file dualDfpn.cc.
References local, runGC(), and shared.
Referenced by findProof(), isWinningState(), and prepareDfpn().
void osl::checkmate::DualDfpn::runGC | ( | bool | verbose = false , |
size_t | memory_use_ratio_1000 = 0 |
||
) |
Definition at line 301 of file dualDfpn.cc.
References osl::BLACK, osl::misc::elapsedSeconds(), findProof(), local_table_growth_limit, osl::OslConfig::memoryUseLimit(), shared, and osl::WHITE.
Referenced by isWinningState(), and prepareDfpnSmall().
void osl::checkmate::DualDfpn::setRootPlayer | ( | Player | root | ) |
Definition at line 602 of file dualDfpn.cc.
References osl::alt(), setVerbose(), and shared.
Referenced by writeRootHistory().
void osl::checkmate::DualDfpn::setVerbose | ( | int | level = 1 | ) |
Definition at line 609 of file dualDfpn.cc.
References distance().
Referenced by isWinningState(), and setRootPlayer().
const osl::checkmate::DfpnTable & osl::checkmate::DualDfpn::table | ( | Player | attack | ) | const |
Definition at line 640 of file dualDfpn.cc.
References shared.
Referenced by isWinningState(), and totalNodeCount().
size_t osl::checkmate::DualDfpn::totalNodeCount | ( | ) | const |
Definition at line 631 of file dualDfpn.cc.
References shared, and table().
Referenced by isWinningState(), and mainNodeCount().
void osl::checkmate::DualDfpn::writeRootHistory | ( | const RepetitionCounter & | counter, |
const MoveStack & | moves, | ||
const SimpleState & | state, | ||
Player | attack | ||
) |
Definition at line 577 of file dualDfpn.cc.
References osl::RepetitionCounter::checkCount(), osl::container::MoveStack::hasLastMove(), osl::RepetitionCounter::history(), osl::Move::isNormal(), osl::container::MoveStack::lastMove(), prepareDfpn(), osl::PieceStand::previousStand(), osl::checkmate::Dfpn::setIllegal(), setRootPlayer(), shared, osl::hash::HashKeyStack::top(), and osl::WHITE.
Referenced by isLosingState(), and isWinningState().
|
private |
Definition at line 34 of file dualDfpn.h.
Referenced by findProof(), isLosingState(), isWinningState(), prepareDfpn(), and prepareDfpnSmall().
|
private |
Definition at line 32 of file dualDfpn.h.
Referenced by distance(), findProof(), isLosingState(), isWinningState(), mainNodeCount(), prepareDfpn(), prepareDfpnSmall(), runGC(), setRootPlayer(), table(), totalNodeCount(), and writeRootHistory().