Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
osl::checkmate::Dfpn Class Reference

詰探索 More...

#include <dfpn.h>

Collaboration diagram for osl::checkmate::Dfpn:
Collaboration graph
[legend]

List of all members.

Classes

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

Public Types

enum  { MaxDepth = OSL_DFPN_MAX_DEPTH }
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(), 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(), 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 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)
template<Player P, bool UseTable>
void proofOracleDefense (const ProofOracle &oracle)
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

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

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 ()

Private Attributes

DfpnTabletable
boost::scoped_ptr< Treetree
boost::scoped_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 110 of file dfpn.h.


Member Typedef Documentation

Definition at line 115 of file dfpn.h.

Definition at line 116 of file dfpn.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
MaxDepth 

Definition at line 113 of file dfpn.h.

anonymous enum
Enumerator:
DfpnMaxUniqMoves 

Definition at line 114 of file dfpn.h.


Constructor & Destructor Documentation

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

Definition at line 1125 of file dfpn.cc.

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

Definition at line 1130 of file dfpn.cc.


Member Function Documentation

void osl::checkmate::Dfpn::analyze ( const PathEncoding path,
const NumEffectState &  state,
const vector< Move > &  moves 
) const
template<osl::Player P>
void osl::checkmate::Dfpn::attack ( )

Definition at line 1480 of file dfpn.cc.

References osl::stat::Ratio::add(), osl::PieceStand::add(), osl::alt(), osl::checkmate::LibertyEstimator::attackH(), osl::checkmate::attackProofCost(), osl::checkmate::BadAttackLoop, osl::checkmate::DfpnRecordBase::best_move, osl::BISHOP, osl::BLACK, osl::checkmate::ProofDisproof::Checkmate(), CHECKMATE_A3_GOLD, osl::misc::BitOp::countBit(), osl::checkmate::DfpnRecordBase::dag_moves, debug_time_start, osl::checkmate::Edge_Table, osl::find(), osl::PtypeTable::getEffect(), osl::GOLD, osl::checkmate::FixedDepthSearcher::hasCheckmateMove(), osl::EffectContent::hasUnblockableEffect(), IgnoreUpwardDisproofThreshold, osl::checkmate::ProofDisproof::isCheckmateFail(), osl::checkmate::ProofDisproof::isCheckmateSuccess(), osl::Move::isDrop(), osl::checkmate::ProofDisproof::isFinal(), osl::checkmate::ProofDisproof::isLoopDetection(), osl::isMajor(), osl::Move::isNormal(), osl::isPromoted(), osl::checkmate::DfpnRecordBase::last_move, osl::checkmate::DisproofPieces::leaf(), LongDropCount, osl::checkmate::ProofDisproof::LOOP_DETECTION_PROOF, osl::checkmate::ProofDisproof::LoopDetection(), osl::eval::max(), osl::eval::min(), osl::checkmate::DfpnRecordBase::min_pdp, osl::checkmate::Dfpn::NodeBase::moved, osl::checkmate::King8Info::moves(), osl::checkmate::ProofDisproof::NoCheckmate(), osl::checkmate::DfpnRecordBase::node_count, osl::checkmate::ProofDisproof::NoEscape(), NoPromoeIgnoreDisproofThreshold, NoPromoeIgnoreProofThreshold, osl::checkmate::Dfpn::NodeBase::path, osl::checkmate::Dfpn::NodeBase::path_record, osl::PAWN, osl::checkmate::ProofDisproof::PAWN_CHECK_MATE_PROOF, osl::checkmate::ProofDisproof::PawnCheckmate(), 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::checkmate::EdgeTable::resetEdgeFromLiberty(), osl::ROOK, osl::checkmate::DfpnRecord::setDisproofPieces(), osl::checkmate::DfpnRecord::setProofPieces(), osl::checkmate::DfpnRecordBase::solved, osl::checkmate::DfpnRecord::stands, target, osl::checkmate::Dfpn::NodeBase::threshold, timer, osl::unpromote(), UpwardWeight, osl::checkmate::Dfpn::Node::visit_time, osl::WHITE, and osl::checkmate::DfpnRecordBase::working_threads.

Referenced by osl::checkmate::Dfpn::Node::setCheckmateAttack().

template<osl::Player P>
void osl::checkmate::Dfpn::blockingSimulation ( int  seed,
const ProofOracle oracle 
)
void osl::checkmate::Dfpn::clear ( )

Definition at line 1134 of file dfpn.cc.

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

Definition at line 156 of file dfpn.h.

References table.

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

Definition at line 1917 of file dfpn.cc.

References osl::checkmate::Dfpn::Node::allocate(), osl::alt(), osl::checkmate::BadAttackLoop, osl::checkmate::DfpnRecordBase::best_move, osl::BLACK, blocking_verify, osl::checkmate::Dfpn::Node::children, osl::checkmate::Dfpn::Node::children_path, osl::misc::BitOp::countBit(), osl::checkmate::DfpnRecordBase::dag_moves, debug_time_start, osl::checkmate::ProofDisproof::disproof(), osl::checkmate::ProofDisproof::DISPROOF_LIMIT, osl::checkmate::ProofDisproof::DISPROOF_MAX, osl::checkmate::DfpnPathRecord::distance, osl::checkmate::DfpnRecordBase::false_branch, osl::find(), osl::PathEncoding::getDepth(), osl::checkmate::FixedDepthSearcher::hasEscapeByMove(), osl::checkmate::Dfpn::NodeBase::hash_key, osl::checkmate::Dfpn::Node::hashes, IgnoreUpwardProofThreshold, osl::checkmate::ProofDisproof::isCheckmateFail(), osl::checkmate::ProofDisproof::isCheckmateSuccess(), osl::Move::isDrop(), osl::checkmate::ProofDisproof::isFinal(), osl::checkmate::Dfpn::Node::isLoop(), osl::checkmate::ProofDisproof::isLoopDetection(), osl::Move::isNormal(), osl::KING, osl::checkmate::DfpnRecordBase::last_move, osl::checkmate::DfpnRecordBase::last_to, osl::checkmate::ProofPieces::leaf(), osl::eval::max(), MEMORIZE_SOLVED_IN_BITSET, osl::eval::min(), osl::checkmate::DfpnRecordBase::min_pdp, osl::checkmate::Dfpn::NodeBase::moved, osl::checkmate::Dfpn::Node::moves, osl::checkmate::DfpnRecordBase::need_full_width, osl::checkmate::Dfpn::Node::nextWhiteStand(), osl::checkmate::DfpnRecordBase::node_count, osl::checkmate::ProofDisproof::NoEscape(), osl::checkmate::Dfpn::NodeBase::path, osl::checkmate::Dfpn::NodeBase::path_record, 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::checkmate::DfpnRecord::setProofPieces(), osl::checkmate::DfpnRecordBase::solved, osl::Square::square, osl::checkmate::DfpnRecord::stands, target, osl::checkmate::Dfpn::NodeBase::threshold, timer, osl::Move::to(), UpwardWeight, osl::checkmate::Dfpn::Node::visit_time, osl::WHITE, osl::checkmate::Dfpn::NodeBase::white_stand, and osl::checkmate::DfpnRecordBase::working_threads.

Referenced by osl::checkmate::Dfpn::Node::setNoCheckmateDefense().

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

Definition at line 2790 of file dfpn.cc.

References osl::checkmate::DfpnPathRecord::distance.

void osl::checkmate::Dfpn::findDagSource ( ) [private]
template<osl::Player P>
void osl::checkmate::Dfpn::generateCheck ( const NumEffectState &  state,
DfpnMoveVector moves,
bool &  has_pawn_checkmate 
) [static]
template<osl::Player P>
void osl::checkmate::Dfpn::generateEscape ( const NumEffectState &  state,
bool  need_full_width,
Square  grand_parent_delay_last_to,
DfpnMoveVector moves 
) [static]

Pは攻撃側

Definition at line 1839 of file dfpn.cc.

References osl::alt(), osl::find(), osl::Move::hasIgnoredUnpromote(), moves, osl::Move::to(), and osl::Move::unpromote().

template<osl::Player P>
void osl::checkmate::Dfpn::grandParentSimulation ( int  cur_move,
const Node gparent,
int  gp_move 
)
bool osl::checkmate::Dfpn::grandParentSimulationSuitable ( ) const

test suitability of simulation of grand-parent relation

Definition at line 1896 of file dfpn.cc.

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

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(),
vector< Move > *  pv = 0 
)
const osl::checkmate::ProofDisproof osl::checkmate::Dfpn::hasCheckmateMove ( const NumEffectState &  state,
const HashKey &  key,
const PathEncoding path,
size_t  limit,
Move best_move,
PieceStand proof,
Move  last_move = Move::INVALID(),
vector< Move > *  pv = 0 
)
const osl::checkmate::ProofDisproof osl::checkmate::Dfpn::hasEscapeMove ( const NumEffectState &  state,
const HashKey &  key,
const PathEncoding path,
size_t  limit,
Move  last_move 
)
size_t osl::checkmate::Dfpn::nodeCount ( ) const [inline]

Definition at line 155 of file dfpn.h.

References node_count.

Referenced by osl::checkmate::DualDfpn::findProof(), and osl::annotate::Analyzer::isCheckmate().

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

Definition at line 2421 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::checkmate::FixedDepthSearcher::hasCheckmateMove(), osl::checkmate::Dfpn::NodeBase::hash_key, osl::checkmate::ProofDisproof::isCheckmateSuccess(), osl::Move::isDrop(), osl::checkmate::ProofDisproof::isFinal(), osl::checkmate::Dfpn::Node::isLoop(), osl::Move::isNormal(), osl::checkmate::Dfpn::ProofOracle::key, osl::checkmate::DfpnRecordBase::last_move, osl::checkmate::Dfpn::NodeBase::moved, osl::checkmate::Dfpn::Node::moves, osl::checkmate::Dfpn::ProofOracle::newOracle(), osl::checkmate::Dfpn::Node::nextWhiteStand(), osl::checkmate::DfpnRecordBase::node_count, osl::checkmate::ProofDisproof::NoEscape(), osl::checkmate::Dfpn::NodeBase::path, osl::checkmate::Dfpn::NodeBase::path_record, osl::PAWN, osl::checkmate::ProofDisproof::PawnCheckmate(), osl::checkmate::DfpnRecordBase::proof_disproof, osl::Move::ptype(), osl::PathEncoding::pushMove(), osl::checkmate::Dfpn::NodeBase::record, osl::checkmate::Dfpn::Node::setCheckmateAttack(), osl::checkmate::Dfpn::Node::setLoopDetection(), osl::checkmate::DfpnRecord::setProofPieces(), osl::checkmate::Dfpn::ProofOracle::traceable(), osl::WHITE, osl::checkmate::Dfpn::ProofOracle::white_stand, and osl::checkmate::Dfpn::NodeBase::white_stand.

template<osl::Player P, bool UseTable>
void osl::checkmate::Dfpn::proofOracleDefense ( const ProofOracle oracle)
void osl::checkmate::Dfpn::setBlockingVerify ( bool  enable = true) [inline]

Definition at line 134 of file dfpn.h.

References blocking_verify.

void osl::checkmate::Dfpn::setIllegal ( const HashKey &  key,
PieceStand  white 
)
void osl::checkmate::Dfpn::setParallel ( int  id,
DfpnShared s 
) [inline]

Definition at line 135 of file dfpn.h.

References parallel_shared, and thread_id.

void osl::checkmate::Dfpn::setTable ( DfpnTable new_table) [inline]
template<osl::Player Turn>
void osl::checkmate::Dfpn::sort ( const NumEffectState &  state,
DfpnMoveVector moves 
) [static]

Definition at line 1384 of file dfpn.cc.

References osl::PTYPE_EMPTY.

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 1222 of file dfpn.cc.

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 1230 of file dfpn.cc.

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

Member Data Documentation

Definition at line 128 of file dfpn.h.

Referenced by setBlockingVerify().

Definition at line 124 of file dfpn.h.

Referenced by nodeCount().

Definition at line 125 of file dfpn.h.

Definition at line 126 of file dfpn.h.

Referenced by setParallel().

boost::scoped_ptr<DfpnPathTable> osl::checkmate::Dfpn::path_table [private]

Definition at line 123 of file dfpn.h.

Definition at line 118 of file dfpn.h.

Referenced by currentTable(), and setTable().

Definition at line 127 of file dfpn.h.

Referenced by setParallel().

boost::scoped_ptr<Tree> osl::checkmate::Dfpn::tree [private]

Definition at line 121 of file dfpn.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines