osl::checkmate::FixedDepthSearcher2 Class Reference

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

深さ固定で，その深さまで depth first searchで読む詰将棋. More...

`#include <fixedDepthSearcher2.h>`

Collaboration diagram for osl::checkmate::FixedDepthSearcher2:
[legend]

## Public Member Functions
| FixedDepthSearcher2 ()
| FixedDepthSearcher2 (NumEffectState &s)
void | setState (NumEffectState &s)
int | getCount () const
template<Player P, bool SetPieces, bool HasGuide>
const ProofDisproof | attack (int depth, Move &best_move, PieceStand &proof_pieces)
template<Player P, bool SetPieces, bool HasGuide>
const ProofDisproof | attackMayUnsafe (int depth, Move &best_move, PieceStand &proof_pieces)
template<Player P, bool SetPieces>
const ProofDisproof | defense (Move last_move, int depth, PieceStand &proof_pieces)
template<Player P>
const ProofDisproof | hasCheckmateMove (int depth, Move &best_move, PieceStand &proof_pieces)
| stateがPから詰む局面かを返す. More...
template<Player P>
const ProofDisproof | hasCheckmateWithGuide (int depth, Move &guide, PieceStand &proof_pieces)
| guide を最初に試す． guide.isNormal() である必要はあるが，その局面でvalid でなくても良い More...
template<Player P>
const ProofDisproof | hasCheckmateMove (int depth, Move &best_move)
template<Player P>
const ProofDisproof | hasCheckmateMove (int depth)
template<Player P>
const ProofDisproof | hasEscapeMove (Move last_move, int depth, PieceStand &proof_pieces)
| stateがPによって詰んでいる局面かを返す. More...
template<Player P>
const ProofDisproof | hasEscapeMove (Move last_move, int depth)
template<Player P>
const ProofDisproof | hasEscapeByMove (Move next_move, int depth, Move &check_move, PieceStand &proof_pieces)
| next_move を指して逃げられるかどうかを調べる More...
template<Player P>
const ProofDisproof | hasEscapeByMove (Move next_move, int depth)
const ProofDisproof | hasCheckmateMoveOfTurn (int depth, Move &best_move)
const ProofDisproof | hasCheckmateMoveOfTurn (int depth, Move &best_move, PieceStand &proof_pieces)
const ProofDisproof | hasCheckmateWithGuideOfTurn (int depth, Move &guide, PieceStand &proof_pieces)
const ProofDisproof | hasEscapeMoveOfTurn (Move last_move, int depth)
const ProofDisproof | hasEscapeByMoveOfTurn (Move next_move, int depth, Move &check_move, PieceStand &proof_pieces)
const ProofDisproof | hasEscapeByMoveOfTurn (Move next_move, int depth)
template<Player Defense>
void | generateBlockingWhenLiberty0 (int depth, Piece defense_king, Square attack_from, container::MoveVector &moves) const
| 無駄合をなるべく生成しない，合駒生成 More...
template<Player Defense>
int | blockEstimation (Square attack_from, Square defense_king) const
template<osl::Player P, bool SetPieces, bool HasGuide>
const osl::checkmate::ProofDisproof | attackMayUnsafe (int depth, Move &best_move, PieceStand &proof_pieces)
template<osl::Player P, bool SetPieces, bool HasGuide>
const osl::checkmate::ProofDisproof | attack (int depth, Move &best_move, PieceStand &proof_pieces)
template<osl::Player P, bool SetPieces>
const osl::checkmate::ProofDisproof | defenseEstimation (int depth, Move last_move, PieceStand &proof_pieces, Piece attacker_piece, Square target_position) const
template<osl::Player Defense>
void | generateBlockingWhenLiberty0 (int depth, Piece defense_king, Square attack_from, MoveVector &moves) const
template<osl::Player P, bool SetPieces>
const osl::checkmate::ProofDisproof | defense (Move last_move, int depth, PieceStand &proof_pieces)
template<osl::Player P>
const osl::checkmate::ProofDisproof | hasEscapeByMove (Move next_move, int depth, Move &check_move, PieceStand &proof_pieces)
template<osl::Player P>
const osl::checkmate::ProofDisproof | hasEscapeByMove (Move next_move, int depth)
template<osl::Player P>
const osl::checkmate::ProofDisproof | hasCheckmateWithGuide (int depth, Move &guide, PieceStand &proof_pieces)

## Private Member Functions
void | addCount ()
template<Player P, bool SetPieces>
const ProofDisproof | defenseEstimation (int depth, Move last_move, PieceStand &proof_pieces, Piece attacker_piece, Square target_position) const
| move を作らずに ProofDisproof の予測を計算する More...

## Private Attributes
NumEffectState * | original_state
CArray< NumEffectState, MAXDEPTH > | states
int | count

## Static Private Attributes
static const int | MAXDEPTH =16

## Detailed Description

深さ固定で，その深さまで depth first searchで読む詰将棋.

深さ0で詰み状態かどうか(攻め手の手番の場合)，王手をかける手がないかを判定可能 深さ1で通常の一手詰みを判定(攻め手の手番の場合) 使うのは深さ3位まで? 攻撃側の自殺手はmove generationはしない． NumEffectState専用

Definition at line 29 of file fixedDepthSearcher2.h.

## Constructor & Destructor Documentation

osl::checkmate::FixedDepthSearcher2::FixedDepthSearcher2 | ( | ) |  |
| inline

Definition at line 40 of file fixedDepthSearcher2.h.

osl::checkmate::FixedDepthSearcher2::FixedDepthSearcher2 | ( | NumEffectState & | s) |  |
| inlineexplicit

Definition at line 43 of file fixedDepthSearcher2.h.

## Member Function Documentation

void osl::checkmate::FixedDepthSearcher2::addCount | ( | ) |  |
| inlineprivate

Definition at line 52 of file fixedDepthSearcher2.h.

template<osl::Player P, bool SetPieces, bool HasGuide>

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::attack | ( | int | depth,
|  | Move & | best_move,
|  | PieceStand & | proof_pieces
| ) |  |

Definition at line 39 of file fixedDepthSearcher2.tcc.

References osl::PieceStand::add(), osl::alt(), osl::checkmate::ProofPieces::attack(), osl::checkmate::ProofNumberTable::attackEstimation(), osl::checkmate::ProofDisproof::Checkmate(), depth, osl::checkmate::ProofDisproof::disproof(), osl::Move::from(), osl::checkmate::ProofDisproof::isCheckmateSuccess(), osl::Move::isDrop(), osl::move_classifier::Check< P >::isMember(), osl::eval::min(), moves, osl::checkmate::ProofDisproof::NoCheckmate(), osl::checkmate::ProofDisproof::PAWN_CHECK_MATE_PROOF, osl::checkmate::ProofDisproof::PawnCheckmate(), osl::checkmate::ProofDisproof::proof(), osl::checkmate::ProofDisproof::PROOF_MAX, osl::checkmate::Proof_Number_Table, osl::Move::ptype(), and osl::Move::to().

template<Player P, bool SetPieces, bool HasGuide>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::attack | ( | int | depth,
|  | Move & | best_move,
|  | PieceStand & | proof_pieces
| ) |  |

template<osl::Player P, bool SetPieces, bool HasGuide>

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::attackMayUnsafe | ( | int | depth,
|  | Move & | best_move,
|  | PieceStand & | proof_pieces
| ) |  |

Definition at line 25 of file fixedDepthSearcher2.tcc.

References depth, osl::checkmate::ProofDisproof::NoEscape(), and states.

template<Player P, bool SetPieces, bool HasGuide>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::attackMayUnsafe | ( | int | depth,
|  | Move & | best_move,
|  | PieceStand & | proof_pieces
| ) |  |

template<osl::Player Defense>

int osl::checkmate::FixedDepthSearcher2::blockEstimation | ( | Square | attack_from,
|  | Square | defense_king
| ) |  | const
| inline

Definition at line 209 of file fixedDepthSearcher2.tcc.

template<Player P, bool SetPieces>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::defense | ( | Move | last_move,
|  | int | depth,
|  | PieceStand & | proof_pieces
| ) |  |

template<osl::Player P, bool SetPieces>

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::defense | ( | Move | last_move,
|  | int | depth,
|  | PieceStand & | proof_pieces
| ) |  |

直前の攻め方の手が自殺手

Definition at line 218 of file fixedDepthSearcher2.tcc.

References osl::checkmate::ProofPiecesUtil::addMonopolizedPieces(), osl::alt(), depth, osl::checkmate::ProofDisproof::DISPROOF_MAX, osl::GOLD, osl::Move::isDrop(), osl::Piece::isEmpty(), osl::effect_util::UnblockableCheck::isMember(), osl::Square::isOnBoard(), osl::Move::isValid(), osl::checkmate::ProofPieces::leaf(), osl::PieceStand::max(), moves, osl::checkmate::ProofDisproof::NoCheckmate(), osl::checkmate::ProofDisproof::NoEscape(), osl::PAWN, osl::checkmate::ProofDisproof::PawnCheckmate(), osl::Move::ptype(), osl::SILVER, osl::Piece::square(), and store().

template<Player P, bool SetPieces>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::defenseEstimation | ( | int | depth,
|  | Move | last_move,
|  | PieceStand & | proof_pieces,
|  | Piece | attacker_piece,
|  | Square | target_position
| ) |  | const
| private

move を作らずに ProofDisproof の予測を計算する

template<osl::Player P, bool SetPieces>

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::defenseEstimation | ( | int | depth,
|  | Move | last_move,
|  | PieceStand & | proof_pieces,
|  | Piece | attacker_piece,
|  | Square | target_position
| ) |  | const
| inline

Definition at line 131 of file fixedDepthSearcher2.tcc.

References osl::alt(), count, depth, osl::PtypeTable::getEffect(), osl::EffectContent::hasUnblockableEffect(), osl::Move::isDrop(), osl::Piece::isEmpty(), osl::Neighboring8::isNeighboring8(), osl::Move::isValid(), osl::checkmate::ProofPieces::leaf(), osl::checkmate::ProofDisproof::NoEscape(), osl::PAWN, osl::checkmate::ProofDisproof::PawnCheckmate(), osl::Move::ptype(), osl::Ptype_Table, osl::Piece::ptypeO(), and osl::Piece::square().

template<Player Defense>

void osl::checkmate::FixedDepthSearcher2::generateBlockingWhenLiberty0 | ( | int | depth,
|  | Piece | defense_king,
|  | Square | attack_from,
|  | container::MoveVector & | moves
| ) |  | const

無駄合をなるべく生成しない，合駒生成

template<osl::Player Defense>

void osl::checkmate::FixedDepthSearcher2::generateBlockingWhenLiberty0 | ( | int | depth,
|  | Piece | defense_king,
|  | Square | attack_from,
|  | MoveVector & | moves
| ) |  | const

Definition at line 174 of file fixedDepthSearcher2.tcc.

References depth, osl::Move::from(), osl::Move::isDrop(), osl::Neighboring8::isNeighboring8(), osl::Piece::square(), store(), and osl::Move::to().

int osl::checkmate::FixedDepthSearcher2::getCount | ( | ) |  | const
| inline

Definition at line 57 of file fixedDepthSearcher2.h.

References count.

template<Player P>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::hasCheckmateMove | ( | int | depth,
|  | Move & | best_move,
|  | PieceStand & | proof_pieces
| ) |  |
| inline

stateがPから詰む局面かを返す.

stateの手番はPと一致しているという前提

Definition at line 84 of file fixedDepthSearcher2.h.

References depth.

template<Player P>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::hasCheckmateMove | ( | int | depth,
|  | Move & | best_move
| ) |  |
| inline

Definition at line 98 of file fixedDepthSearcher2.h.

References depth.

template<Player P>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::hasCheckmateMove | ( | int | depth) |  |
| inline

Definition at line 105 of file fixedDepthSearcher2.h.

References depth.

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::hasCheckmateMoveOfTurn | ( | int | depth,
|  | Move & | best_move
| ) |  |

Definition at line 20 of file fixedDepthSearcher2.cc.

References osl::BLACK, and depth.

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::hasCheckmateMoveOfTurn | ( | int | depth,
|  | Move & | best_move,
|  | PieceStand & | proof_pieces
| ) |  |

Definition at line 9 of file fixedDepthSearcher2.cc.

References osl::BLACK, depth, and states.

template<Player P>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::hasCheckmateWithGuide | ( | int | depth,
|  | Move & | guide,
|  | PieceStand & | proof_pieces
| ) |  |

guide を最初に試す． guide.isNormal() である必要はあるが，その局面でvalid でなくても良い

template<osl::Player P>

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::hasCheckmateWithGuide | ( | int | depth,
|  | Move & | guide,
|  | PieceStand & | proof_pieces
| ) |  |

Definition at line 396 of file fixedDepthSearcher2.tcc.

References depth, osl::Move::from(), osl::Move::isDrop(), osl::Move::isNormal(), osl::Piece::isPtype(), osl::KING, osl::Move::newCapture(), osl::Move::ptype(), and osl::Move::to().

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::hasCheckmateWithGuideOfTurn | ( | int | depth,
|  | Move & | guide,
|  | PieceStand & | proof_pieces
| ) |  |

Definition at line 31 of file fixedDepthSearcher2.cc.

References osl::BLACK, and depth.

template<Player P>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::hasEscapeByMove | ( | Move | next_move,
|  | int | depth,
|  | Move & | check_move,
|  | PieceStand & | proof_pieces
| ) |  |

next_move を指して逃げられるかどうかを調べる

Parameters

  check_move | 詰の場合の攻撃側の指手
  depth | next_move を指した後からカウント

template<Player P>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::hasEscapeByMove | ( | Move | next_move,
|  | int | depth
| ) |  |

template<osl::Player P>

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::hasEscapeByMove | ( | Move | next_move,
|  | int | depth,
|  | Move & | check_move,
|  | PieceStand & | proof_pieces
| ) |  |

Definition at line 369 of file fixedDepthSearcher2.tcc.

template<osl::Player P>

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::hasEscapeByMove | ( | Move | next_move,
|  | int | depth
| ) |  |

Definition at line 383 of file fixedDepthSearcher2.tcc.

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::hasEscapeByMoveOfTurn | ( | Move | next_move,
|  | int | depth,
|  | Move & | check_move,
|  | PieceStand & | proof_pieces
| ) |  |

Definition at line 53 of file fixedDepthSearcher2.cc.

References osl::BLACK, and depth.

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::hasEscapeByMoveOfTurn | ( | Move | next_move,
|  | int | depth
| ) |  |

Definition at line 65 of file fixedDepthSearcher2.cc.

References osl::BLACK, and depth.

template<Player P>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::hasEscapeMove | ( | Move | last_move,
|  | int | depth,
|  | PieceStand & | proof_pieces
| ) |  |
| inline

stateがPによって詰んでいる局面かを返す.

王手がかかっていない時には呼ばない stateの手番はalt(P)と一致しているという前提 stateはPによって王手がかかっているという前提

Parameters

  last_move | 打ち歩詰めの判定に必要

Definition at line 119 of file fixedDepthSearcher2.h.

References depth.

template<Player P>

const ProofDisproof osl::checkmate::FixedDepthSearcher2::hasEscapeMove | ( | Move | last_move,
|  | int | depth
| ) |  |
| inline

Definition at line 125 of file fixedDepthSearcher2.h.

References depth.

const osl::checkmate::ProofDisproof osl::checkmate::FixedDepthSearcher2::hasEscapeMoveOfTurn | ( | Move | last_move,
|  | int | depth
| ) |  |

Definition at line 42 of file fixedDepthSearcher2.cc.

References osl::BLACK, and depth.

void osl::checkmate::FixedDepthSearcher2::setState | ( | NumEffectState & | s) |  |
| inline

Definition at line 47 of file fixedDepthSearcher2.h.

## Member Data Documentation

int osl::checkmate::FixedDepthSearcher2::count
| private

Definition at line 38 of file fixedDepthSearcher2.h.

const int osl::checkmate::FixedDepthSearcher2::MAXDEPTH =16
| staticprivate

Definition at line 35 of file fixedDepthSearcher2.h.

NumEffectState* osl::checkmate::FixedDepthSearcher2::original_state
| private

Definition at line 36 of file fixedDepthSearcher2.h.

CArray<NumEffectState,MAXDEPTH> osl::checkmate::FixedDepthSearcher2::states
| private

Definition at line 37 of file fixedDepthSearcher2.h.

Referenced by attackMayUnsafe(), and hasCheckmateMoveOfTurn().

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

- fixedDepthSearcher2.h
- fixedDepthSearcher2.tcc
- fixedDepthSearcher2.cc