All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
osl::search::QuiescenceSearch2< EvalT > Class Template Reference

取り合い探索 (静止探索). More...

#include <quiescenceSearch2.h>

Inheritance diagram for osl::search::QuiescenceSearch2< EvalT >:
Inheritance graph
[legend]
Collaboration diagram for osl::search::QuiescenceSearch2< EvalT >:
Collaboration graph
[legend]

Public Types

enum  EvalUpdateState { AfterUpdate, BeforeUpdate }
 
typedef EvalT eval_t
 
typedef NumEffectState effect_state_t
 
typedef container::MoveVector MoveVector
 

Public Member Functions

 QuiescenceSearch2 (SearchState2Core &s, SimpleHashTable &t)
 
template<Player P>
int search (eval_t &ev, Move last_move, int depth=QSearchTraits::MaxDepth)
 
int search (Player P, eval_t &ev, Move last_move, int depth=QSearchTraits::MaxDepth)
 
template<Player P>
int searchIteratively (eval_t &ev, Move last_move, int depth=QSearchTraits::MaxDepth)
 
int searchIteratively (Player P, eval_t &ev, Move last_move, int depth=QSearchTraits::MaxDepth)
 
template<Player P>
int searchIteratively (int alpha, int beta, eval_t &ev, Move last_move, int depth)
 
template<Player P>
int search (int alpha, int beta, eval_t &ev, Move last_move, int depth=QSearchTraits::MaxDepth)
 
int search (Player P, int alpha, int beta, eval_t &ev, Move last_move, int depth)
 
template<Player P>
int searchProbCut (int alpha, int beta, eval_t &ev, Move last_move)
 
int searchProbCut (Player P, int alpha, int beta, eval_t &ev, Move last_move)
 
template<Player P>
int searchInternal (int alpha, int beta, eval_t &ev, Move last_move, int additional_depth=0, EvalUpdateState need_eval_update=AfterUpdate)
 
template<Player P, bool has_record>
int staticValue (eval_t const &ev, int alpha, int beta, QuiescenceRecord *record)
 
template<Player P, bool has_record, bool has_dont_capture, MoveType move_type>
bool examineMoves (QuiescenceRecord *record, int &curVal, const Move *first, const Move *last, int &alpha, int beta, eval_t const &ev, int additional_depth, Square dont_capture=Square::STAND())
 
template<Player P>
int takeBackValue (int alpha, int beta, eval_t const &ev, Move last_move)
 単純な取り返しの探索. More...
 
template<Player P>
bool examineTakeBack (const MoveVector &moves, int &cur_val, int &alpha, int beta, eval_t const &ev)
 
template<Player P, bool calm_move_only, bool first_nolmal_move_only>
bool examineTakeBack2 (const MoveVector &moves, QuiescenceThreat &threat2, QuiescenceThreat &threat1, int beta, int beta2, eval_t const &ev)
 末端の取り返し用. More...
 
template<Player P, Ptype PTYPE>
bool generateAndExamineTakeBack2 (MoveVector &moves, QuiescenceThreat &threat2, QuiescenceThreat &threat1, int beta1, int beta2, eval_t const &ev)
 末端の取り返し用. More...
 
template<Player P>
int takeBackOrChase (int alpha, int beta, eval_t const &ev, Move last_move)
 last_move が逃げる手で、逃げた先の取り返し、または追撃の価値を判定 More...
 
template<Player P>
int staticValueWithThreat (eval_t const &ev, int alpha, QuiescenceThreat &threat1, QuiescenceThreat &threat2)
 
template<Player P>
int staticValueWithThreat (eval_t const &ev)
 
int staticValueWithThreat (eval_t const &ev)
 
int nodeCount () const
 
const NumEffectState & currentState () const
 

Private Types

typedef FixedEval base_t
 
- Private Types inherited from osl::search::QSearchTraits
enum  { MaxDepth = 8, CheckmateSpecialDepth = 127, HistorySpecialDepth = 126 }
 
enum  { FirstThreat = 6, SecondThreat = 2 }
 
enum  MoveType {
  UNKNOWN, KING_ESCAPE, CAPTURE, PROMOTE,
  CHECK, ESCAPE, ATTACK, OTHER
}
 

Private Member Functions

int depthFromRoot () const
 rootからの深さ More...
 
int depth () const
 残り深さ More...
 
template<Player P, bool has_record>
int searchMain (QuiescenceRecord *record, int alpha, int beta, eval_t &ev, Move last_move, int additional_depth, EvalUpdateState &need_eval_update)
 
template<Player P, Ptype PTYPE, bool has_record>
bool examineCapture (QuiescenceRecord *record, int &curVal, MoveVector &working, int &alpha, int beta, eval_t const &ev, Piece last_piece, int additional_depth)
 PTYPE を取る手を生成して examineMoves を呼ぶ More...
 
template<Player P>
int passValue (int alpha, int beta, eval_t const &ev)
 
int currentValueWithLastThreat (eval_t const &ev, Piece last_move_piece)
 

Private Attributes

SearchState2Corestate
 
SimpleHashTabletable
 
int root_depth
 
int max_depth
 
int node_count
 探索ノード数 More...
 

Additional Inherited Members

- Protected Member Functions inherited from osl::search::FixedEval
 FixedEval ()
 
void setDrawValue (int value)
 
int drawValue () const
 
 ~FixedEval ()
 
- Static Protected Member Functions inherited from osl::search::FixedEval
static int winByFoul (Player P)
 相手の王手千日手,打歩詰. More...
 
static int winByLoop (Player P)
 駒得するループ. More...
 
static int winByCheckmate (Player P)
 詰による勝 More...
 
static int minusInfty (Player P)
 探索windowの下限 (負けでも更新される値) More...
 
static int winThreshold (Player P)
 この値を越えれば勝. More...
 
static int windowMax (Player P)
 探索して意味がある範囲 (偶数) More...
 
static int brinkmatePenalty (Player P, int limit)
 必死(に見える)局面の評価値 Pが負けそう More...
 
static int threatmatePenalty (Player P)
 末端で詰めろがかかっている場合のペナルティ. More...
 
static int isWinValue (Player P, int val)
 勝かどうか. More...
 

Detailed Description

template<class EvalT>
class osl::search::QuiescenceSearch2< EvalT >

取り合い探索 (静止探索).

TODO:

Definition at line 41 of file quiescenceSearch2.h.

Member Typedef Documentation

template<class EvalT >
typedef FixedEval osl::search::QuiescenceSearch2< EvalT >::base_t
private

Definition at line 43 of file quiescenceSearch2.h.

template<class EvalT >
typedef NumEffectState osl::search::QuiescenceSearch2< EvalT >::effect_state_t

Definition at line 64 of file quiescenceSearch2.h.

template<class EvalT >
typedef EvalT osl::search::QuiescenceSearch2< EvalT >::eval_t

Definition at line 63 of file quiescenceSearch2.h.

template<class EvalT >
typedef container::MoveVector osl::search::QuiescenceSearch2< EvalT >::MoveVector

Definition at line 67 of file quiescenceSearch2.h.

Member Enumeration Documentation

Enumerator
AfterUpdate 
BeforeUpdate 

Definition at line 148 of file quiescenceSearch2.h.

Constructor & Destructor Documentation

template<class EvalT >
osl::search::QuiescenceSearch2< EvalT >::QuiescenceSearch2 ( SearchState2Core s,
SimpleHashTable t 
)
inline

Definition at line 69 of file quiescenceSearch2.h.

Member Function Documentation

template<class EvalT >
const NumEffectState& osl::search::QuiescenceSearch2< EvalT >::currentState ( ) const
inline
template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::currentValueWithLastThreat ( eval_t const &  ev,
Piece  last_move_piece 
)
private
template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::depth ( ) const
inlineprivate
template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::depthFromRoot ( ) const
inlineprivate
template<class EvalT >
template<osl::Player P, osl::Ptype PTYPE, bool has_record>
bool osl::search::QuiescenceSearch2< EvalT >::examineCapture ( QuiescenceRecord record,
int &  curVal,
MoveVector working,
int &  alpha,
int  beta,
eval_t const &  ev,
Piece  last_piece,
int  additional_depth 
)
inlineprivate

PTYPE を取る手を生成して examineMoves を呼ぶ

Returns
cut できるか

Definition at line 264 of file quiescenceSearch2.tcc.

References moves, and osl::Piece::square().

template<class EvalT >
template<osl::Player P, bool has_record, bool has_dont_capture, osl::search::QSearchTraits::MoveType move_type>
bool osl::search::QuiescenceSearch2< EvalT >::examineMoves ( QuiescenceRecord record,
int &  curVal,
const Move first,
const Move last,
int &  alpha,
int  beta,
eval_t const &  ev,
int  additional_depth,
Square  dont_capture = Square::STAND() 
)
template<class EvalT >
template<osl::Player P>
bool osl::search::QuiescenceSearch2< EvalT >::examineTakeBack ( const MoveVector moves,
int &  cur_val,
int &  alpha,
int  beta,
eval_t const &  ev 
)
template<class EvalT >
template<osl::Player P, bool calm_move_only, bool first_normal_move_only>
bool osl::search::QuiescenceSearch2< EvalT >::examineTakeBack2 ( const MoveVector moves,
QuiescenceThreat threat2,
QuiescenceThreat threat1,
int  beta,
int  beta2,
eval_t const &  ev 
)

末端の取り返し用.

二つthreatを求める

Parameters
threat1最大の脅威
threat22番目の脅威
calm_move_only相手の利きがあるマスにはいかない
king_attack_pieceP に王手をかけている駒(のうちの一つ)

Definition at line 1478 of file quiescenceSearch2.tcc.

References osl::alt(), osl::eval::betterThan(), osl::BISHOP, osl::eval::delta(), depth, osl::record::usi::escape(), finish, osl::PtypeTable::getEffect(), osl::EffectContent::hasEffect(), osl::importantMove(), osl::isMajor(), moves, osl::eval::notLessThan(), osl::Move::ptype(), osl::Ptype_Table, result, osl::ROOK, target, osl::Move::to(), osl::unpromote(), and osl::search::QuiescenceThreat::value.

template<class EvalT >
template<osl::Player P, osl::Ptype PTYPE>
bool osl::search::QuiescenceSearch2< EvalT >::generateAndExamineTakeBack2 ( MoveVector moves,
QuiescenceThreat threat2,
QuiescenceThreat threat1,
int  beta1,
int  beta2,
eval_t const &  ev 
)
inline

末端の取り返し用.

各取れる駒毎に指手を生成して examineTakeBack2 を呼ぶ

Definition at line 234 of file quiescenceSearch2.tcc.

References osl::alt(), osl::Piece::isOnBoardByOwner(), osl::KNIGHT, osl::LANCE, moves, osl::PAWN, result, osl::Piece::square(), and target.

template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::nodeCount ( ) const
inline
template<class EvalT >
template<osl::Player P>
int osl::search::QuiescenceSearch2< EvalT >::passValue ( int  alpha,
int  beta,
eval_t const &  ev 
)
private

Definition at line 710 of file quiescenceSearch2.tcc.

References BOOST_STATIC_ASSERT(), max_depth, and result.

template<class EvalT >
template<Player P>
int osl::search::QuiescenceSearch2< EvalT >::search ( eval_t ev,
Move  last_move,
int  depth = QSearchTraits::MaxDepth 
)
inline
template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::search ( Player  P,
eval_t ev,
Move  last_move,
int  depth = QSearchTraits::MaxDepth 
)
inline
template<class EvalT >
template<Player P>
int osl::search::QuiescenceSearch2< EvalT >::search ( int  alpha,
int  beta,
eval_t ev,
Move  last_move,
int  depth = QSearchTraits::MaxDepth 
)
inline
template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::search ( Player  P,
int  alpha,
int  beta,
eval_t ev,
Move  last_move,
int  depth 
)
inline
template<class EvalT >
template<osl::Player P>
int osl::search::QuiescenceSearch2< EvalT >::searchInternal ( int  alpha,
int  beta,
eval_t ev,
Move  last_move,
int  additional_depth = 0,
EvalUpdateState  need_eval_update = AfterUpdate 
)
template<class EvalT >
template<Player P>
int osl::search::QuiescenceSearch2< EvalT >::searchIteratively ( eval_t ev,
Move  last_move,
int  depth = QSearchTraits::MaxDepth 
)
inline
template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::searchIteratively ( Player  P,
eval_t ev,
Move  last_move,
int  depth = QSearchTraits::MaxDepth 
)
inline
template<class EvalT >
template<Player P>
int osl::search::QuiescenceSearch2< EvalT >::searchIteratively ( int  alpha,
int  beta,
eval_t ev,
Move  last_move,
int  depth 
)
inline
template<class EvalT >
template<osl::Player P, bool has_record>
int osl::search::QuiescenceSearch2< EvalT >::searchMain ( QuiescenceRecord record,
int  alpha,
int  beta,
eval_t ev,
Move  last_move,
int  additional_depth,
EvalUpdateState need_eval_update 
)
private

Definition at line 731 of file quiescenceSearch2.tcc.

References osl::stat::Ratio::add(), osl::search::QuiescenceRecord::addKillerMoves(), allocate_depth_in_threatmate, osl::alt(), osl::search::QuiescenceRecord::bestMove(), osl::eval::betterThan(), osl::BISHOP, osl::canPromote(), osl::ntesuki::capture(), osl::Move::capturePtype(), osl::search::QuiescenceRecord::checkmateNodesLeft(), osl::eval::delta(), depth, osl::find(), finish, osl::Move::from(), osl::Move::isCapture(), osl::Move::isDrop(), osl::isMajor(), osl::isMajorBasic(), osl::Move::isNormal(), osl::Move::isPass(), osl::isPiece(), osl::Piece::isPiece(), osl::Square::isPieceStand(), osl::search::DualThreatmateState::isThreatmate(), osl::Move::isValid(), osl::KING, osl::KNIGHT, osl::LANCE, osl::search::QuiescenceRecord::loadMoves(), osl::search::QuiescenceRecord::lowerBound(), osl::search::QuiescenceRecord::lowerDepth(), osl::eval::max(), max_depth, osl::search::DualThreatmateState::maybeThreatmate(), osl::search::DualThreatmateState::mayHaveCheckmate(), osl::eval::min(), moves, osl::search::QuiescenceRecord::movesEmpty(), osl::search::QuiescenceRecord::movesSizeLessThan(), osl::newPtypeO(), osl::eval::notLessThan(), osl::Piece::owner(), osl::PAWN, osl::promote(), osl::Move::ptype(), osl::PTYPE_EMPTY, osl::search::qallocate(), ratio, result, osl::ROOK, osl::search::QuiescenceRecord::sendOffSquare(), osl::search::QuiescenceRecord::setLowerBound(), osl::search::QuiescenceRecord::setUpperBound(), osl::Piece::square(), osl::search::QuiescenceRecordBase::threatmate, osl::search::DualThreatmateState::threatmateMove(), osl::Move::to(), osl::unpromote(), osl::search::QuiescenceRecord::upperBound(), and osl::search::QuiescenceRecord::upperDepth().

template<class EvalT >
template<osl::Player P>
int osl::search::QuiescenceSearch2< EvalT >::searchProbCut ( int  alpha,
int  beta,
eval_t ev,
Move  last_move 
)
template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::searchProbCut ( Player  P,
int  alpha,
int  beta,
eval_t ev,
Move  last_move 
)
inline

Definition at line 140 of file quiescenceSearch2.h.

References osl::BLACK.

template<class EvalT >
template<osl::Player P, bool has_record>
int osl::search::QuiescenceSearch2< EvalT >::staticValue ( eval_t const &  ev,
int  alpha,
int  beta,
QuiescenceRecord record 
)
inline
template<class EvalT >
template<osl::Player P>
int osl::search::QuiescenceSearch2< EvalT >::staticValueWithThreat ( eval_t const &  ev,
int  alpha,
QuiescenceThreat threat1,
QuiescenceThreat threat2 
)
template<class EvalT >
template<Player P>
int osl::search::QuiescenceSearch2< EvalT >::staticValueWithThreat ( eval_t const &  ev)
inline

Definition at line 229 of file quiescenceSearch2.h.

References osl::alt(), and osl::search::FixedEval::winThreshold().

template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::staticValueWithThreat ( eval_t const &  ev)
inline
template<class EvalT >
template<osl::Player P>
int osl::search::QuiescenceSearch2< EvalT >::takeBackOrChase ( int  alpha,
int  beta,
eval_t const &  ev,
Move  last_move 
)

last_move が逃げる手で、逃げた先の取り返し、または追撃の価値を判定

Definition at line 1657 of file quiescenceSearch2.tcc.

References osl::alt(), osl::eval::betterThan(), osl::Move::from(), osl::Move::isNormal(), osl::eval::max(), moves, osl::newPtypeO(), osl::PROOK, osl::Move::ptypeO(), result, osl::ROOK, and osl::Move::to().

template<class EvalT >
template<osl::Player P>
int osl::search::QuiescenceSearch2< EvalT >::takeBackValue ( int  alpha,
int  beta,
eval_t const &  ev,
Move  last_move 
)

単純な取り返しの探索.

PieceEval::computeDiffAfterMoveForRP と異なり,盤面を動かす. 王手を正確に判定し,利きも伸びる

Parameters
attack_piecelast_move が王手回避の時に王手をかけていた駒

Definition at line 1695 of file quiescenceSearch2.tcc.

References osl::alt(), osl::eval::betterThan(), osl::eval::delta(), osl::Move::isPass(), osl::LANCE, moves, osl::eval::notLessThan(), osl::Piece::square(), and osl::Move::to().

Member Data Documentation

template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::max_depth
private
template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::node_count
private

探索ノード数

Definition at line 51 of file quiescenceSearch2.h.

Referenced by osl::search::QuiescenceSearch2< EvalT >::nodeCount().

template<class EvalT >
int osl::search::QuiescenceSearch2< EvalT >::root_depth
private
template<class EvalT >
SearchState2Core& osl::search::QuiescenceSearch2< EvalT >::state
private
template<class EvalT >
SimpleHashTable& osl::search::QuiescenceSearch2< EvalT >::table
private

Definition at line 45 of file quiescenceSearch2.h.


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