All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Attributes | Private Member Functions | Friends | List of all members
osl::search::SearchState2Core Class Reference

#include <searchState2.h>

Inheritance diagram for osl::search::SearchState2Core:
Inheritance graph
[legend]
Collaboration diagram for osl::search::SearchState2Core:
Collaboration graph
[legend]

Classes

struct  UpdateWrapper
 
struct  Updator
 

Public Types

enum  { MaxDepth = 64 }
 
typedef DualDfpn checkmate_t
 
typedef FixedCapacityVector
< Move, MaxDepth
PVVector
 

Public Member Functions

 SearchState2Core (const NumEffectState &s, checkmate_t &checker)
 
virtual ~SearchState2Core ()
 
int curDepth () const
 
virtual void setState (const NumEffectState &s)
 state のコピーを行う. More...
 
void setHistory (const MoveStack &h)
 
bool hasLastRecord (unsigned int n=0) const
 
SimpleHashRecordlastRecord (unsigned int n=0)
 
const SimpleHashRecordlastRecord (unsigned int n=0) const
 
SimpleHashRecordrootRecord ()
 
void setCurrentRecord (SimpleHashRecord *r)
 
void setRootRecord (SimpleHashRecord *root)
 
void setKillerMove (Move best_move)
 
void getBigramKillerMoves (MoveVector &moves) const
 
void getKillerMoves (MoveVector &moves) const
 
const BigramKillerMovebigramKillerMove () const
 
void setBigramKillerMove (const BigramKillerMove &killers)
 
HistoryTablehistoryTable ()
 
const HistoryTablehistoryTable () const
 
void pushPass ()
 
void popPass ()
 
template<Player P, class Function >
void doUndoMoveOrPass (const HashKey &new_hash, Move move, Function &f)
 まともなdoUndo More...
 
void makeMove (Move move)
 
const Move lastMove (int i=1) const
 
const MoveStack & history () const
 
const RecordStack2recordHistory () const
 
const PathEncodingpath () const
 
const NumEffectState & state () const
 
const NumEffectState & rootState () const
 
void restoreRootState ()
 
const checkmate_tcheckmateSearcher () const
 
const RepetitionCounterrepetitionCounter () const
 
const HashKey & currentHash () const
 
template<Player P, class Function >
void doUndoMoveLight (Move move, Function &f)
 軽量化版 doUndo 千日手情報や, hash を更新しない More...
 
template<Player P>
bool isLosingState (int node_limit)
 
template<Player P>
bool isWinningState (int node_limit, Move &checkmate_move, bool parallel=false)
 
template<Player P>
bool isWinningStateShort (int depth, Move &checkmate_move)
 FixedDepthSearcher を呼ぶ More...
 
template<Player P>
bool isThreatmateState (int node_limit, Move &threatmate_move, bool=false)
 P の手番でPの玉に詰めろがかかっているかどうか More...
 
template<Player P>
bool isThreatmateStateShort (int depth, Move &threatmate_move)
 
bool abort () const
 
virtual bool abort (Move) const
 
bool tryThreatmate () const
 
void makePV (Move m)
 
void initPV ()
 
void makePV (PVVector &parent, Move m, PVVector &pv) const
 
int countCheckAfterThreatmate (Player turn, int depth=1) const
 turn の側が連続王手で詰ろを逃れている回数 More...
 
int countCheckAfterThreatmateSacrifice (Player turn, int depth=1) const
 

Static Public Member Functions

template<Player P>
static bool isWinningState (checkmate_t &search, NumEffectState &state, const HashKey &key, PathEncoding path, int node_limit, Move &checkmate_move, Move last_move, bool=false)
 
static bool isWinningState (checkmate_t &search, NumEffectState &state, const HashKey &key, PathEncoding path, int node_limit, Move &checkmate_move, Move last_move, bool parallel=false)
 

Public Attributes

volatile bool stop_tree
 beta cut in parallel search More...
 

Static Public Attributes

static CArray< int, MaxDepthdepth_node_count_quiesce
 

Protected Types

enum  NodeType { PvNode = 0, AllNode = 1, CutNode = -1 }
 

Protected Attributes

NumEffectState current_state
 
NumEffectState root_state
 
checkmate_tcheckmate_searcher
 
PathEncoding current_path
 
MoveStack move_history
 
int root_depth
 
RecordStack2 record_stack
 
RepetitionCounter repetition_counter
 
boost::shared_ptr
< SearchState2Shared
shared
 
CArray< PVVector, MaxDepthpv
 
CArray< NodeType, MaxDepthnode_type
 

Private Member Functions

void pushBeforeApply (Move move)
 ApplyMoveの前に行うこと More...
 
void updateRepetitionCounterAfterMove (const HashKey &new_hash)
 pushBeforeApply の後,ApplyMoveの中,Functionを呼ぶ前に呼ばれる More...
 
void popAfterApply ()
 ApplyMoveの後に行うこと More...
 
void makeMoveHook (Move)
 

Friends

struct AlphaBeta2ParallelCommon
 
struct Updator
 

Detailed Description

Definition at line 86 of file searchState2.h.

Member Typedef Documentation

Definition at line 94 of file searchState2.h.

Definition at line 113 of file searchState2.h.

Member Enumeration Documentation

anonymous enum
Enumerator
MaxDepth 

Definition at line 93 of file searchState2.h.

Enumerator
PvNode 
AllNode 
CutNode 

Definition at line 116 of file searchState2.h.

Constructor & Destructor Documentation

osl::search::SearchState2Core::SearchState2Core ( const NumEffectState &  s,
checkmate_t checker 
)

Definition at line 54 of file searchState2.cc.

References hasLastRecord(), and setState().

osl::search::SearchState2Core::~SearchState2Core ( )
virtual

Definition at line 63 of file searchState2.cc.

Member Function Documentation

bool osl::search::SearchState2Core::abort ( ) const

Definition at line 121 of file searchState2.cc.

Referenced by osl::search::SearchState2::abort().

bool osl::search::SearchState2Core::abort ( Move  best_move) const
virtual
const BigramKillerMove& osl::search::SearchState2Core::bigramKillerMove ( ) const
inline

Definition at line 189 of file searchState2.h.

const checkmate_t& osl::search::SearchState2Core::checkmateSearcher ( ) const
inline

Definition at line 298 of file searchState2.h.

int osl::search::SearchState2Core::countCheckAfterThreatmate ( Player  turn,
int  depth = 1 
) const
inline

turn の側が連続王手で詰ろを逃れている回数

Definition at line 454 of file searchState2.h.

References osl::search::ThreatmateState::CHECK_AFTER_THREATMATE, depth, and result.

int osl::search::SearchState2Core::countCheckAfterThreatmateSacrifice ( Player  turn,
int  depth = 1 
) const
inline
int osl::search::SearchState2Core::curDepth ( ) const
inline

Definition at line 126 of file searchState2.h.

const HashKey& osl::search::SearchState2Core::currentHash ( ) const
inline

Definition at line 302 of file searchState2.h.

References osl::RepetitionCounter::history().

template<Player P, class Function >
void osl::search::SearchState2Core::doUndoMoveLight ( Move  move,
Function &  f 
)
inline

軽量化版 doUndo 千日手情報や, hash を更新しない

Definition at line 311 of file searchState2.h.

References osl::PathEncoding::popMove(), and osl::PathEncoding::pushMove().

template<Player P, class Function >
void osl::search::SearchState2Core::doUndoMoveOrPass ( const HashKey &  new_hash,
Move  move,
Function &  f 
)
inline

まともなdoUndo

Definition at line 273 of file searchState2.h.

References osl::PathEncoding::popMove(), and osl::PathEncoding::pushMove().

void osl::search::SearchState2Core::getBigramKillerMoves ( MoveVector &  moves) const
inline

Definition at line 176 of file searchState2.h.

void osl::search::SearchState2Core::getKillerMoves ( MoveVector &  moves) const
inline

Definition at line 184 of file searchState2.h.

bool osl::search::SearchState2Core::hasLastRecord ( unsigned int  n = 0) const
inline

Definition at line 136 of file searchState2.h.

References osl::search::RecordStack2::hasLastRecord().

Referenced by SearchState2Core().

const MoveStack& osl::search::SearchState2Core::history ( ) const
inline

Definition at line 292 of file searchState2.h.

Referenced by osl::search::MoveGenerator::generateKingEscape().

HistoryTable& osl::search::SearchState2Core::historyTable ( )
inline

Definition at line 193 of file searchState2.h.

const HistoryTable& osl::search::SearchState2Core::historyTable ( ) const
inline

Definition at line 194 of file searchState2.h.

void osl::search::SearchState2Core::initPV ( )
inline

Definition at line 443 of file searchState2.h.

References depth.

template<Player P>
bool osl::search::SearchState2Core::isLosingState ( int  node_limit)
inline

Definition at line 319 of file searchState2.h.

References osl::checkmate::DualDfpn::isLosingState(), and search_assert.

template<Player P>
bool osl::search::SearchState2Core::isThreatmateState ( int  node_limit,
Move threatmate_move,
bool  = false 
)
inline

P の手番でPの玉に詰めろがかかっているかどうか

Definition at line 380 of file searchState2.h.

References osl::Move::PASS(), and search_assert.

template<Player P>
bool osl::search::SearchState2Core::isThreatmateStateShort ( int  depth,
Move threatmate_move 
)
inline
template<Player P>
static bool osl::search::SearchState2Core::isWinningState ( checkmate_t search,
NumEffectState &  state,
const HashKey &  key,
PathEncoding  path,
int  node_limit,
Move checkmate_move,
Move  last_move,
bool  = false 
)
inlinestatic
static bool osl::search::SearchState2Core::isWinningState ( checkmate_t search,
NumEffectState &  state,
const HashKey &  key,
PathEncoding  path,
int  node_limit,
Move checkmate_move,
Move  last_move,
bool  parallel = false 
)
inlinestatic

Definition at line 349 of file searchState2.h.

References osl::BLACK, and search().

template<Player P>
bool osl::search::SearchState2Core::isWinningState ( int  node_limit,
Move checkmate_move,
bool  parallel = false 
)
inline

Definition at line 362 of file searchState2.h.

References search_assert.

template<Player P>
bool osl::search::SearchState2Core::isWinningStateShort ( int  depth,
Move checkmate_move 
)
inline
const Move osl::search::SearchState2Core::lastMove ( int  i = 1) const
inline

Definition at line 291 of file searchState2.h.

Referenced by osl::search::MoveGenerator::generateTakeBack().

SimpleHashRecord* osl::search::SearchState2Core::lastRecord ( unsigned int  n = 0)
inline

Definition at line 140 of file searchState2.h.

References osl::search::RecordStack2::lastRecord().

const SimpleHashRecord* osl::search::SearchState2Core::lastRecord ( unsigned int  n = 0) const
inline

Definition at line 144 of file searchState2.h.

References osl::search::RecordStack2::lastRecord().

void osl::search::SearchState2Core::makeMove ( Move  move)
inline

Definition at line 283 of file searchState2.h.

Referenced by osl::search::AlphaBeta2< EvalT >::makeMove().

void osl::search::SearchState2Core::makeMoveHook ( Move  )
private

Definition at line 170 of file searchState2.cc.

void osl::search::SearchState2Core::makePV ( Move  m)
inline

Definition at line 438 of file searchState2.h.

References depth.

void osl::search::SearchState2Core::makePV ( PVVector parent,
Move  m,
PVVector pv 
) const

Definition at line 146 of file searchState2.cc.

References osl::Move::isPass().

const PathEncoding& osl::search::SearchState2Core::path ( ) const
inline
void osl::search::SearchState2Core::popAfterApply ( )
inlineprivate

ApplyMoveの後に行うこと

Definition at line 259 of file searchState2.h.

References osl::search::RecordStack2::pop(), and osl::RepetitionCounter::pop().

void osl::search::SearchState2Core::popPass ( )
inline

Definition at line 203 of file searchState2.h.

References osl::alt(), osl::Move::PASS(), and osl::PathEncoding::popMove().

void osl::search::SearchState2Core::pushBeforeApply ( Move  move)
inlineprivate

ApplyMoveの前に行うこと

Definition at line 214 of file searchState2.h.

References osl::search::RecordStack2::push().

void osl::search::SearchState2Core::pushPass ( )
inline

Definition at line 196 of file searchState2.h.

References osl::Move::PASS(), and osl::PathEncoding::pushMove().

const RecordStack2& osl::search::SearchState2Core::recordHistory ( ) const
inline

Definition at line 293 of file searchState2.h.

const RepetitionCounter& osl::search::SearchState2Core::repetitionCounter ( ) const
inline

Definition at line 299 of file searchState2.h.

void osl::search::SearchState2Core::restoreRootState ( )

Definition at line 85 of file searchState2.cc.

SimpleHashRecord* osl::search::SearchState2Core::rootRecord ( )
inline

Definition at line 148 of file searchState2.h.

References osl::search::RecordStack2::rootRecord().

const NumEffectState& osl::search::SearchState2Core::rootState ( ) const
inline

Definition at line 296 of file searchState2.h.

void osl::search::SearchState2Core::setBigramKillerMove ( const BigramKillerMove killers)

Definition at line 106 of file searchState2.cc.

void osl::search::SearchState2Core::setCurrentRecord ( SimpleHashRecord r)
inline
void osl::search::SearchState2Core::setHistory ( const MoveStack &  h)

Definition at line 98 of file searchState2.cc.

void osl::search::SearchState2Core::setKillerMove ( Move  best_move)
inline
void osl::search::SearchState2Core::setRootRecord ( SimpleHashRecord root)
inline
void osl::search::SearchState2Core::setState ( const NumEffectState &  s)
virtual

state のコピーを行う.

this->state は探索終了後も保存されるが,探索中に exception が起こると 破壊されている

Reimplemented in osl::search::SearchState2.

Definition at line 68 of file searchState2.cc.

Referenced by SearchState2Core(), and osl::search::SearchState2::setState().

const NumEffectState& osl::search::SearchState2Core::state ( ) const
inline
bool osl::search::SearchState2Core::tryThreatmate ( ) const
inline
void osl::search::SearchState2Core::updateRepetitionCounterAfterMove ( const HashKey &  new_hash)
inlineprivate

pushBeforeApply の後,ApplyMoveの中,Functionを呼ぶ前に呼ばれる

Definition at line 252 of file searchState2.h.

References osl::RepetitionCounter::push().

Friends And Related Function Documentation

friend struct AlphaBeta2ParallelCommon
friend

Definition at line 91 of file searchState2.h.

friend struct Updator
friend

Definition at line 248 of file searchState2.h.

Member Data Documentation

checkmate_t* osl::search::SearchState2Core::checkmate_searcher
protected

Definition at line 97 of file searchState2.h.

PathEncoding osl::search::SearchState2Core::current_path
protected

Definition at line 105 of file searchState2.h.

NumEffectState osl::search::SearchState2Core::current_state
protected

Definition at line 96 of file searchState2.h.

osl::CArray< int, osl::search::SearchState2Core::MaxDepth > osl::search::SearchState2Core::depth_node_count_quiesce
static

Definition at line 122 of file searchState2.h.

MoveStack osl::search::SearchState2Core::move_history
protected

Definition at line 106 of file searchState2.h.

CArray<NodeType,MaxDepth> osl::search::SearchState2Core::node_type
protected

Definition at line 117 of file searchState2.h.

CArray<PVVector,MaxDepth> osl::search::SearchState2Core::pv
protected
RecordStack2 osl::search::SearchState2Core::record_stack
protected

Definition at line 109 of file searchState2.h.

RepetitionCounter osl::search::SearchState2Core::repetition_counter
protected

Definition at line 110 of file searchState2.h.

int osl::search::SearchState2Core::root_depth
protected

Definition at line 107 of file searchState2.h.

NumEffectState osl::search::SearchState2Core::root_state
protected

Definition at line 96 of file searchState2.h.

boost::shared_ptr<SearchState2Shared> osl::search::SearchState2Core::shared
protected

Definition at line 111 of file searchState2.h.

volatile bool osl::search::SearchState2Core::stop_tree

beta cut in parallel search

Definition at line 120 of file searchState2.h.

Referenced by osl::search::AlphaBeta2Tree< EvalT >::stopping(), and osl::search::AlphaBeta2Tree< EvalT >::testStop().


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