My Project
osl::checkmate::Dfpn Class Reference

詰探索 More...

#include <dfpn.h>

Classes

struct  DepthLimitReached
struct  ProofOracle
struct  NodeBase
struct  Node
struct  Tree
struct  CallAttack
struct  CallDefense
struct  CallProofOracleAttack
struct  CallProofOracleDefense

Public Types

enum  { DfpnMaxUniqMoves = CheckOrEscapeMaxUniqMoves }
typedef CheckMoveVector DfpnMoveVector
typedef DfpnTable table_t

Public Member Functions

 Dfpn ()
 ~Dfpn ()
void setTable (DfpnTable *new_table)
void setIllegal (const HashKey &key, PieceStand white)
void setBlockingVerify (bool enable=true)
void setParallel (int id, DfpnShared *s)
const ProofDisproof hasCheckmateMove (const NumEffectState &state, const HashKey &key, const PathEncoding &path, size_t limit, Move &best_move, Move last_move=Move::INVALID(), std::vector< Move > *pv=0)
const ProofDisproof hasCheckmateMove (const NumEffectState &state, const HashKey &key, const PathEncoding &path, size_t limit, Move &best_move, PieceStand &proof, Move last_move=Move::INVALID(), std::vector< Move > *pv=0)
const ProofDisproof hasEscapeMove (const NumEffectState &state, const HashKey &key, const PathEncoding &path, size_t limit, Move last_move)
size_t nodeCount () const
const DfpnTablecurrentTable () const
void analyze (const PathEncoding &path, const NumEffectState &state, const std::vector< Move > &moves) const
void clear ()
template<Player P>
void attack ()
template<Player P>
void defense ()
template<Player P, bool UseTable>
void proofOracleAttack (const ProofOracle &oracle, int proof_limit)
template<Player P, bool UseTable>
void proofOracleDefense (const ProofOracle &oracle, int proof_limit)
template<Player P>
void blockingSimulation (int seed, const ProofOracle &)
 合駒が詰と判った直後に、同じような合駒を詰める
template<Player P>
void grandParentSimulation (int cur_move, const Node &gparent, int gp_move)
const ProofDisproof tryProof (const NumEffectState &state, const HashKey &key, const PathEncoding &path, const ProofOracle &, size_t oracle_id, Move &best_move, Move last_move=Move::INVALID())
const ProofDisproof tryProofLight (const NumEffectState &state, const HashKey &key, const PathEncoding &path, const ProofOracle &, size_t oracle_id, Move &best_move, Move last_move=Move::INVALID())
int distance (const HashKey &) const
bool grandParentSimulationSuitable () const
 test suitability of simulation of grand-parent relation
template<bool UseTable>
const osl::checkmate::ProofDisproof tryProofMain (const NumEffectState &state, const HashKey &key, const PathEncoding &path, const ProofOracle &oracle, size_t oracle_id, Move &best_move, Move last_move)

Static Public Member Functions

template<Player P>
static void generateCheck (const NumEffectState &, DfpnMoveVector &, bool &)
 Pは攻撃側
template<Player P>
static void generateEscape (const NumEffectState &, bool need_full_width, Square grand_parent_delay_last_to, DfpnMoveVector &)
 Pは攻撃側
template<Player Turn>
static void sort (const NumEffectState &, DfpnMoveVector &)

Private Member Functions

 Dfpn (const Dfpn &)=delete
Dfpnoperator= (const Dfpn &)=delete
template<bool UseTable>
const ProofDisproof tryProofMain (const NumEffectState &state, const HashKey &key, const PathEncoding &path, const ProofOracle &, size_t oracle_id, Move &best_move, Move last_move)
void findDagSource ()
void findDagSource (const HashKey &terminal_key, DfpnRecord &terminal_record, PieceStand terminal_stand, int offset=0)

Private Attributes

DfpnTabletable
std::unique_ptr< Treetree
std::unique_ptr< DfpnPathTablepath_table
size_t node_count
size_t node_count_limit
DfpnSharedparallel_shared
int thread_id
bool blocking_verify

Detailed Description

詰探索

Definition at line 106 of file dfpn.h.

Member Typedef Documentation

◆ DfpnMoveVector

Definition at line 112 of file dfpn.h.

◆ table_t

Definition at line 113 of file dfpn.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
DfpnMaxUniqMoves 

Definition at line 111 of file dfpn.h.

Constructor & Destructor Documentation

◆ Dfpn() [1/2]

◆ Dfpn() [2/2]

osl::checkmate::Dfpn::Dfpn ( )

Definition at line 1287 of file dfpn.cc.

References blocking_verify, parallel_shared, path_table, table, thread_id, and tree.

◆ ~Dfpn()

osl::checkmate::Dfpn::~Dfpn ( )

Definition at line 1292 of file dfpn.cc.

Member Function Documentation

◆ analyze()

◆ attack()

template<osl::Player P>
void osl::checkmate::Dfpn::attack ( )

Definition at line 1655 of file dfpn.cc.

References osl::PieceStand::add(), osl::stat::Ratio::add(), AdHocSumScale, osl::checkmate::Dfpn::Node::allocate(), osl::alt(), osl::checkmate::LibertyEstimator::attackH(), osl::checkmate::attackProofCost(), osl::checkmate::BadAttackLoop, osl::BISHOP, osl::BLACK, osl::hash::HashKey128::blackStand(), osl::checkmate::ProofDisproof::Checkmate(), CHECKMATE_A3_GOLD, osl::checkmate::Dfpn::Node::children, osl::checkmate::Dfpn::Node::children_path, osl::misc::BitOp::countBit(), DagFindThreshold, DagFindThreshold2, debug_time_start, osl::checkmate::ProofDisproof::disproof(), osl::checkmate::DfpnPathRecord::distance, osl::checkmate::Edge_Table, osl::FixedCapacityVector< T, Capacity >::empty(), EnableGCDepth, findDagSource(), generateCheck(), osl::PathEncoding::getDepth(), osl::GOLD, osl::checkmate::FixedDepthSolverExt::hasCheckmateMove(), osl::checkmate::ImmediateCheckmate::hasCheckmateMove(), osl::checkmate::Dfpn::NodeBase::hash_key, osl::checkmate::Dfpn::Node::hashes, osl::EffectContent::hasUnblockableEffect(), IgnoreUpwardDisproofThreshold, osl::HashRandomPair::initialized(), osl::checkmate::ProofDisproof::isCheckmateFail(), osl::checkmate::ProofDisproof::isCheckmateSuccess(), osl::Move::isDrop(), osl::checkmate::Dfpn::Node::isLoop(), osl::checkmate::ProofDisproof::isLoopDetection(), osl::isMajor(), osl::Move::isNormal(), osl::isPromoted(), osl::checkmate::DisproofPieces::leaf(), LongDropCount, osl::checkmate::ProofDisproof::LOOP_DETECTION_PROOF, osl::checkmate::ProofDisproof::LoopDetection(), osl::checkmate::Dfpn::NodeBase::moved, osl::checkmate::Dfpn::Node::moves, osl::hash::HashKey::newHashWithMove(), osl::checkmate::Dfpn::Node::nextWhiteStand(), osl::checkmate::ProofDisproof::NoCheckmate(), node_count, osl::checkmate::DfpnPathRecord::node_count, node_count_limit, osl::checkmate::ProofDisproof::NoEscape(), NoPromoeIgnoreDisproofThreshold, NoPromoeIgnoreProofThreshold, parallel_shared, osl::checkmate::Dfpn::NodeBase::path, osl::checkmate::Dfpn::NodeBase::path_record, path_table, osl::PAWN, osl::checkmate::ProofDisproof::PAWN_CHECK_MATE_PROOF, osl::checkmate::ProofDisproof::PawnCheckmate(), osl::checkmate::ProofDisproof::proof(), osl::checkmate::Dfpn::Node::proof_cost, osl::checkmate::DfpnRecordBase::proof_disproof, osl::checkmate::ProofDisproof::PROOF_LIMIT, osl::Move::ptype(), osl::Ptype_Table, osl::PathEncoding::pushMove(), osl::checkmate::Dfpn::NodeBase::record, osl::ROOK, osl::checkmate::Dfpn::Node::setCheckmateAttack(), osl::checkmate::Dfpn::Node::setLoopDetection(), osl::checkmate::Dfpn::Node::setNoCheckmateAttack(), osl::FixedCapacityVector< T, Capacity >::size(), osl::checkmate::slow_increase(), table, thread_id, osl::checkmate::Dfpn::NodeBase::threshold, timer, tree, osl::unpromote(), UpwardWeight, osl::HashRandomPair::value(), osl::checkmate::Dfpn::Node::visit_time, osl::WHITE, and osl::checkmate::Dfpn::NodeBase::white_stand.

Referenced by hasCheckmateMove(), osl::checkmate::Dfpn::Node::setCheckmateAttack(), osl::checkmate::Dfpn::Node::setCheckmateDefense(), osl::checkmate::Dfpn::Node::setNoCheckmateAttack(), osl::checkmate::Dfpn::Node::setNoCheckmateDefense(), and osl::checkmate::Dfpn::Tree::setNoCheckmateDefense().

◆ blockingSimulation()

◆ clear()

void osl::checkmate::Dfpn::clear ( )

Definition at line 1305 of file dfpn.cc.

References path_table.

◆ currentTable()

const DfpnTable & osl::checkmate::Dfpn::currentTable ( ) const
inline

Definition at line 153 of file dfpn.h.

References table.

◆ defense()

template<osl::Player P>
void osl::checkmate::Dfpn::defense ( )

Definition at line 2182 of file dfpn.cc.

References AdHocSumScale, osl::checkmate::Dfpn::Node::allocate(), osl::alt(), osl::checkmate::BadAttackLoop, osl::CArray< T, Capacity >::begin(), osl::FixedCapacityVector< T, Capacity >::begin(), osl::BLACK, osl::hash::HashKey128::blackStand(), blocking_verify, blockingSimulation(), osl::checkmate::Dfpn::Node::children, osl::checkmate::Dfpn::Node::children_path, osl::misc::BitOp::countBit(), DagFindThreshold, DagFindThreshold2, debug_time_start, osl::checkmate::ProofDisproof::disproof(), osl::checkmate::ProofDisproof::DISPROOF_LIMIT, osl::checkmate::ProofDisproof::DISPROOF_MAX, osl::checkmate::DfpnPathRecord::distance, osl::FixedCapacityVector< T, Capacity >::empty(), osl::FixedCapacityVector< T, Capacity >::end(), findDagSource(), generateEscape(), osl::PathEncoding::getDepth(), grandParentSimulation(), grandParentSimulationSuitable(), osl::checkmate::FixedDepthSolverExt::hasEscapeByMove(), osl::checkmate::Dfpn::NodeBase::hash_key, osl::checkmate::Dfpn::Node::hashes, IgnoreUpwardProofThreshold, osl::HashRandomPair::initialized(), osl::checkmate::ProofDisproof::isCheckmateFail(), osl::checkmate::ProofDisproof::isCheckmateSuccess(), osl::Move::isDrop(), osl::checkmate::Dfpn::Node::isLoop(), osl::Move::isNormal(), osl::KING, osl::checkmate::ProofPieces::leaf(), MEMORIZE_SOLVED_IN_BITSET, osl::checkmate::Dfpn::NodeBase::moved, osl::checkmate::Dfpn::Node::moves, osl::hash::HashKey::newHashWithMove(), osl::checkmate::Dfpn::Node::nextWhiteStand(), node_count, osl::checkmate::DfpnPathRecord::node_count, node_count_limit, osl::checkmate::ProofDisproof::NoEscape(), parallel_shared, osl::checkmate::Dfpn::NodeBase::path, osl::checkmate::Dfpn::NodeBase::path_record, path_table, osl::FixedCapacityVector< T, Capacity >::pop_back(), osl::checkmate::ProofDisproof::proof(), osl::checkmate::DfpnRecordBase::proof_disproof, osl::PathEncoding::pushMove(), osl::checkmate::Dfpn::NodeBase::record, SacrificeBlockCount, osl::checkmate::Dfpn::Node::setCheckmateChildInDefense(), osl::checkmate::Dfpn::Node::setCheckmateDefense(), osl::checkmate::Dfpn::Node::setLoopDetection(), osl::FixedCapacityVector< T, Capacity >::size(), osl::checkmate::slow_increase(), osl::checkmate::DfpnRecordBase::solved, table, thread_id, osl::checkmate::Dfpn::NodeBase::threshold, timer, osl::Move::to(), tree, UpwardWeight, osl::HashRandomPair::value(), osl::checkmate::Dfpn::Node::visit_time, osl::WHITE, and osl::checkmate::Dfpn::NodeBase::white_stand.

Referenced by hasEscapeMove().

◆ distance()

int osl::checkmate::Dfpn::distance ( const HashKey & key) const

Definition at line 3130 of file dfpn.cc.

References path_table.

◆ findDagSource() [1/2]

void osl::checkmate::Dfpn::findDagSource ( )
private

Definition at line 1646 of file dfpn.cc.

References findDagSource(), and tree.

Referenced by attack(), defense(), findDagSource(), proofOracleAttack(), and proofOracleDefense().

◆ findDagSource() [2/2]

◆ generateCheck()

◆ generateEscape()

◆ grandParentSimulation()

◆ grandParentSimulationSuitable()

bool osl::checkmate::Dfpn::grandParentSimulationSuitable ( ) const

test suitability of simulation of grand-parent relation

Definition at line 2161 of file dfpn.cc.

References osl::Move::from(), osl::Move::isCapture(), osl::Move::isNormal(), osl::checkmate::Dfpn::NodeBase::moved, osl::Move::to(), and tree.

Referenced by defense(), and proofOracleDefense().

◆ hasCheckmateMove() [1/2]

const osl::checkmate::ProofDisproof osl::checkmate::Dfpn::hasCheckmateMove ( const NumEffectState & state,
const HashKey & key,
const PathEncoding & path,
size_t limit,
Move & best_move,
Move last_move = Move::INVALID(),
std::vector< Move > * pv = 0 )

Definition at line 1328 of file dfpn.cc.

References hasCheckmateMove().

Referenced by osl::checkmate::DualDfpn::findProof(), and hasCheckmateMove().

◆ hasCheckmateMove() [2/2]

◆ hasEscapeMove()

◆ nodeCount()

size_t osl::checkmate::Dfpn::nodeCount ( ) const
inline

Definition at line 152 of file dfpn.h.

References node_count.

Referenced by osl::checkmate::DualDfpn::findProof(), and osl::checkmate::DualDfpn::isLosingState().

◆ operator=()

Dfpn & osl::checkmate::Dfpn::operator= ( const Dfpn & )
privatedelete

References Dfpn().

◆ proofOracleAttack()

template<osl::Player P, bool UseTable>
void osl::checkmate::Dfpn::proofOracleAttack ( const ProofOracle & oracle,
int proof_limit )

Definition at line 2745 of file dfpn.cc.

References osl::PieceStand::add(), osl::stat::Ratio::add(), osl::checkmate::Dfpn::Node::allocate(), osl::alt(), osl::checkmate::OracleAdjust::attack(), osl::checkmate::BadAttackLoop, osl::checkmate::DfpnRecordBase::best_move, osl::checkmate::ProofDisproof::Checkmate(), osl::checkmate::Dfpn::Node::children, osl::checkmate::Dfpn::Node::children_path, osl::FixedCapacityVector< T, Capacity >::clear(), osl::hash::HashKey::dumpContents(), findDagSource(), osl::checkmate::FixedDepthSolverExt::hasCheckmateMove(), osl::checkmate::ImmediateCheckmate::hasCheckmateMove(), osl::checkmate::Dfpn::NodeBase::hash_key, osl::checkmate::ProofDisproof::isCheckmateSuccess(), osl::Move::isDrop(), osl::checkmate::Dfpn::Node::isLoop(), osl::Move::isNormal(), osl::checkmate::Dfpn::ProofOracle::key, osl::checkmate::Dfpn::NodeBase::moved, osl::checkmate::Dfpn::Node::moves, osl::hash::HashKey::newHashWithMove(), osl::checkmate::Dfpn::ProofOracle::newOracle(), osl::checkmate::Dfpn::Node::nextWhiteStand(), node_count, node_count_limit, osl::checkmate::ProofDisproof::NoEscape(), osl::checkmate::Dfpn::NodeBase::path, osl::checkmate::Dfpn::NodeBase::path_record, path_table, osl::PAWN, osl::checkmate::ProofDisproof::PawnCheckmate(), osl::checkmate::DfpnRecordBase::proof_disproof, osl::Move::ptype(), osl::FixedCapacityVector< T, Capacity >::push_back(), osl::PathEncoding::pushMove(), osl::checkmate::Dfpn::NodeBase::record, root_proof_simulation_limit, osl::checkmate::Dfpn::Node::setCheckmateAttack(), osl::checkmate::Dfpn::Node::setLoopDetection(), table, thread_id, osl::checkmate::Dfpn::ProofOracle::traceable(), tree, osl::WHITE, osl::checkmate::Dfpn::NodeBase::white_stand, and osl::checkmate::Dfpn::ProofOracle::white_stand.

Referenced by tryProofMain().

◆ proofOracleDefense()

template<osl::Player P, bool UseTable>
void osl::checkmate::Dfpn::proofOracleDefense ( const ProofOracle & oracle,
int proof_limit )

Definition at line 2871 of file dfpn.cc.

References osl::checkmate::Dfpn::Node::allocate(), osl::alt(), osl::checkmate::BadAttackLoop, osl::checkmate::Dfpn::Node::children, osl::checkmate::Dfpn::Node::children_path, osl::checkmate::DfpnRecord::disproof(), osl::FixedCapacityVector< T, Capacity >::empty(), findDagSource(), generateEscape(), grandParentSimulationSuitable(), osl::checkmate::FixedDepthSolverExt::hasEscapeByMove(), osl::checkmate::Dfpn::NodeBase::hash_key, osl::checkmate::Dfpn::Node::hashes, osl::checkmate::ProofDisproof::isCheckmateFail(), osl::checkmate::ProofDisproof::isCheckmateSuccess(), osl::checkmate::Dfpn::Node::isLoop(), osl::checkmate::ProofPieces::leaf(), osl::checkmate::Dfpn::NodeBase::moved, osl::checkmate::Dfpn::Node::moves, osl::hash::HashKey::newHashWithMove(), osl::checkmate::Dfpn::ProofOracle::newOracle(), osl::checkmate::Dfpn::Node::nextWhiteStand(), osl::checkmate::ProofDisproof::NoCheckmate(), node_count, osl::checkmate::DfpnRecordBase::node_count, osl::checkmate::ProofDisproof::NoEscape(), osl::checkmate::Dfpn::NodeBase::path, osl::checkmate::Dfpn::NodeBase::path_record, path_table, osl::checkmate::DfpnRecord::proof(), osl::checkmate::DfpnRecordBase::proof_disproof, ProofSimulationTolerance, osl::PathEncoding::pushMove(), osl::checkmate::Dfpn::NodeBase::record, osl::checkmate::Dfpn::Node::setCheckmateChildInDefense(), osl::checkmate::Dfpn::Node::setCheckmateDefense(), osl::checkmate::Dfpn::Node::setLoopDetection(), osl::FixedCapacityVector< T, Capacity >::size(), table, osl::Move::to(), osl::checkmate::Dfpn::ProofOracle::traceable(), tree, osl::WHITE, and osl::checkmate::Dfpn::NodeBase::white_stand.

◆ setBlockingVerify()

void osl::checkmate::Dfpn::setBlockingVerify ( bool enable = true)
inline

Definition at line 131 of file dfpn.h.

References blocking_verify.

◆ setIllegal()

◆ setParallel()

void osl::checkmate::Dfpn::setParallel ( int id,
DfpnShared * s )
inline

Definition at line 132 of file dfpn.h.

References parallel_shared, and thread_id.

◆ setTable()

void osl::checkmate::Dfpn::setTable ( DfpnTable * new_table)

Definition at line 1296 of file dfpn.cc.

References EnableGCDepth, GrowthLimitInfty, parallel_shared, path_table, table, and tree.

◆ sort()

template<osl::Player Turn>
void osl::checkmate::Dfpn::sort ( const NumEffectState & state,
DfpnMoveVector & moves )
static

◆ tryProof()

const osl::checkmate::ProofDisproof osl::checkmate::Dfpn::tryProof ( const NumEffectState & state,
const HashKey & key,
const PathEncoding & path,
const ProofOracle & oracle,
size_t oracle_id,
Move & best_move,
Move last_move = Move::INVALID() )

Definition at line 1392 of file dfpn.cc.

References tryProofMain().

Referenced by osl::checkmate::DualDfpn::findProof().

◆ tryProofLight()

const osl::checkmate::ProofDisproof osl::checkmate::Dfpn::tryProofLight ( const NumEffectState & state,
const HashKey & key,
const PathEncoding & path,
const ProofOracle & oracle,
size_t oracle_id,
Move & best_move,
Move last_move = Move::INVALID() )

Definition at line 1400 of file dfpn.cc.

References tryProofMain().

Referenced by osl::checkmate::DualDfpn::findProof().

◆ tryProofMain() [1/2]

template<bool UseTable>
const ProofDisproof osl::checkmate::Dfpn::tryProofMain ( const NumEffectState & state,
const HashKey & key,
const PathEncoding & path,
const ProofOracle & ,
size_t oracle_id,
Move & best_move,
Move last_move )
private

References osl::Move::INVALID().

Referenced by tryProof(), and tryProofLight().

◆ tryProofMain() [2/2]

Member Data Documentation

◆ blocking_verify

bool osl::checkmate::Dfpn::blocking_verify
private

Definition at line 125 of file dfpn.h.

Referenced by defense(), Dfpn(), and setBlockingVerify().

◆ node_count

size_t osl::checkmate::Dfpn::node_count
private

◆ node_count_limit

size_t osl::checkmate::Dfpn::node_count_limit
private

◆ parallel_shared

DfpnShared* osl::checkmate::Dfpn::parallel_shared
private

Definition at line 123 of file dfpn.h.

Referenced by attack(), defense(), Dfpn(), findDagSource(), hasCheckmateMove(), setParallel(), and setTable().

◆ path_table

std::unique_ptr<DfpnPathTable> osl::checkmate::Dfpn::path_table
private

◆ table

◆ thread_id

int osl::checkmate::Dfpn::thread_id
private

◆ tree


The documentation for this class was generated from the following files: