片方の手番の持駒の枚数を記録するクラス. More...
#include <pieceStand.h>
Public Member Functions | |
PieceStand (unsigned int value=0) | |
PieceStand (Player, const state::SimpleState &) | |
PieceStand (int pawnCount, int lanceCount, int knightCount, int silverCount, int goldCount, int bishopCount, int rookCount, int kingCount) | |
void | add (Ptype type, unsigned int num=1) |
void | sub (Ptype type, unsigned int num=1) |
void | tryAdd (Ptype type) |
加算可能なら加える. More... | |
bool | canAdd (Ptype type) const |
void | trySub (Ptype type) |
1枚以上持っていれば減らす More... | |
bool | atMostOneKind () const |
一種類の駒しかない More... | |
void | addAtmostOnePiece (PieceStand const &ps) |
pieceStand同士の加算,減算. More... | |
void | subAtmostOnePiece (PieceStand const &ps) |
unsigned int | get (Ptype type) const |
void | carriesOff () const |
void | carriesOn () const |
unsigned int | testCarries () const |
bool | isSuperiorOrEqualTo (PieceStand other) const |
template<Player P> | |
bool | hasMoreThan (PieceStand other) const |
this と other が BLACK の持駒と考えた時に, this の方が同じか沢山持っていれば真. More... | |
bool | hasMoreThan (Player P, PieceStand other) const |
unsigned int | getFlags () const |
bool | any () const |
どれかの駒を一枚でも持っている More... | |
const PieceStand | max (PieceStand other) const |
種類毎に this と other の持駒の多い方を取る More... | |
const PieceStand | max2 (PieceStand other) const |
種類毎に this と other の持駒の多い方を取る (max のalternative) More... | |
const PieceStand | nextStand (Player pl, Move move) const |
const PieceStand | nextStand (Move move) const |
const PieceStand | previousStand (Player pl, Move move) const |
const PieceStand | previousStand (Move move) const |
Static Public Attributes | |
static const CArray< Ptype, 7 > | order |
持駒の表示で良く使われる順番. More... | |
static const unsigned int | carryMask = 0x48822224 |
Private Member Functions | |
bool | carryUnchangedAfterAdd (const PieceStand &original, const PieceStand &other) const |
bool | carryUnchangedAfterSub (const PieceStand &original, const PieceStand &other) const |
Private Attributes | |
unsigned int | flags |
Static Private Attributes | |
static const CArray< unsigned char, PTYPE_MAX+1 > | shift |
static const CArray< unsigned char, PTYPE_MAX+1 > | mask |
片方の手番の持駒の枚数を記録するクラス.
== を軽くするために carry off の状態を基本とする
Definition at line 40 of file pieceStand.h.
|
inlineexplicit |
Definition at line 51 of file pieceStand.h.
|
explicit |
|
inline |
Definition at line 55 of file pieceStand.h.
References add(), osl::BISHOP, osl::GOLD, osl::KING, osl::KNIGHT, osl::LANCE, osl::PAWN, osl::ROOK, and osl::SILVER.
|
inline |
Definition at line 71 of file pieceStand.h.
References flags, osl::isBasic(), mask, shift, and testCarries().
Referenced by osl::checkmate::ProofPiecesUtil::addMonopolizedPieces(), osl::game_playing::HistoryToTable::adjustDominance(), osl::ntesuki::NtesukiTable::allocateWithMove(), osl::checkmate::FixedDepthSearcher2::attack(), osl::checkmate::FixedDepthSearcher::attack(), osl::checkmate::Dfpn::attack(), osl::ntesuki::NtesukiRecord::calcProofPiecesAnd(), osl::ntesuki::NtesukiRecord::calcProofPiecesOr(), osl::hash::HashGenTable::HashGenTable(), PieceStand(), osl::checkmate::Dfpn::proofOracleAttack(), osl::PieceStandIO::readNumbers(), and osl::ntesuki::NtesukiRecord::setDisproofPieces().
|
inline |
pieceStand同士の加算,減算.
足して良いのは,carry が立っていないpiecestandで かつ,含まれる駒が高々1つ
Definition at line 111 of file pieceStand.h.
References atMostOneKind(), carryUnchangedAfterAdd(), flags, getFlags(), and testCarries().
Referenced by osl::hash::HashKey128::operator+=(), and osl::hash::GeneralHashKey< BoardKeyBase >::operator+=().
|
inline |
bool osl::PieceStand::atMostOneKind | ( | ) | const |
一種類の駒しかない
Definition at line 57 of file pieceStand.cc.
References osl::misc::BitOp::countBit().
Referenced by addAtmostOnePiece(), and subAtmostOnePiece().
bool osl::PieceStand::canAdd | ( | Ptype | type) | const |
Definition at line 43 of file pieceStand.cc.
References osl::PtypeTable::getIndexLimit(), osl::PtypeTable::getIndexMin(), osl::eval::max(), and osl::Ptype_Table.
Referenced by osl::game_playing::HistoryToTable::adjustDominance().
|
inline |
Definition at line 138 of file pieceStand.h.
References carryMask, and flags.
Referenced by isSuperiorOrEqualTo().
|
inline |
Definition at line 139 of file pieceStand.h.
References carryMask, and flags.
Referenced by isSuperiorOrEqualTo().
|
private |
Definition at line 64 of file pieceStand.cc.
References testCarries().
Referenced by addAtmostOnePiece().
|
private |
Definition at line 73 of file pieceStand.cc.
References testCarries().
Referenced by subAtmostOnePiece().
|
inline |
Definition at line 134 of file pieceStand.h.
References flags, mask, and shift.
Referenced by osl::checkmate::ProofPiecesUtil::addMonopolizedPieces(), osl::game_playing::HistoryToTable::adjustDominance(), osl::checkmate::ProofPieces::attack(), osl::ntesuki::NtesukiRecord::calcProofPiecesAnd(), osl::checkmate::DisproofPieces::defense(), osl::operator<<(), osl::ntesuki::NtesukiRecord::setDisproofPieces(), osl::hash::HashKey128::StandHash::toUint64(), osl::checkmate::Dfpn::ProofOracle::traceable(), and osl::PieceStandIO::writeNumbers().
|
inline |
Definition at line 168 of file pieceStand.h.
References flags.
Referenced by addAtmostOnePiece(), osl::hash::HashKey::dumpContents(), osl::hash::HashKey128::operator+=(), osl::hash::HashKey128::operator-=(), osl::operator<(), osl::operator==(), osl::hash::HashKey128::setPieceStand(), and subAtmostOnePiece().
|
inline |
this と other が BLACK の持駒と考えた時に, this の方が同じか沢山持っていれば真.
Definition at line 154 of file pieceStand.h.
References osl::BLACK, and isSuperiorOrEqualTo().
Referenced by osl::search::DominanceCheck::detect(), and osl::ntesuki::NtesukiRecord::isBetterFor().
|
inline |
Definition at line 161 of file pieceStand.h.
References osl::BLACK.
|
inline |
Definition at line 141 of file pieceStand.h.
References carriesOff(), carriesOn(), carryMask, flags, and result.
Referenced by osl::checkmate::DfpnPathList::find(), osl::checkmate::DualDfpn::findProof(), osl::checkmate::DfpnTable::List::findProofOracle(), hasMoreThan(), osl::ntesuki::NtesukiRecord::isDominatedByDisproofPieces(), osl::ntesuki::NtesukiRecord::isDominatedByProofPieces(), osl::checkmate::DfpnTable::List::probe(), osl::checkmate::DfpnTable::List::showProofOracles(), osl::ntesuki::OracleProverLight::startFromAttack(), and osl::ntesuki::OracleProverLight::startFromDefense().
|
inline |
種類毎に this と other の持駒の多い方を取る
Definition at line 174 of file pieceStand.h.
References carryMask, flags, and PieceStand().
Referenced by osl::checkmate::DfpnTable::List::addDag(), osl::ntesuki::NtesukiRecord::calcProofPiecesAnd(), osl::checkmate::FixedDepthSearcher2::defense(), osl::checkmate::FixedDepthSearcher::defense(), osl::checkmate::Dfpn::Node::setCheckmateChildInDefense(), osl::ntesuki::NtesukiRecord::setDisproofPieces(), osl::checkmate::Dfpn::Node::setNoCheckmateChildInAttack(), and osl::checkmate::DfpnTable::List::store().
|
inline |
種類毎に this と other の持駒の多い方を取る (max のalternative)
Definition at line 190 of file pieceStand.h.
References carryMask, flags, and PieceStand().
|
inline |
Definition at line 206 of file pieceStand.h.
References Result::add(), osl::Move::capturePtype(), osl::Move::isDrop(), osl::Move::isNormal(), osl::Move::player(), osl::Move::ptype(), result, and osl::unpromote().
Referenced by osl::checkmate::Dfpn::analyze(), osl::checkmate::Dfpn::ProofOracle::newOracle(), nextStand(), osl::checkmate::Dfpn::Node::nextWhiteStand(), and osl::checkmate::ProofTreeDepthDfpn::orNode().
|
inline |
Definition at line 225 of file pieceStand.h.
References nextStand(), and osl::Move::player().
|
inline |
Definition at line 229 of file pieceStand.h.
References osl::Move::capturePtype(), osl::Move::isDrop(), osl::Move::isNormal(), osl::Move::player(), osl::Move::ptype(), result, and osl::unpromote().
Referenced by osl::checkmate::Dfpn::findDagSource(), previousStand(), and osl::checkmate::DualDfpn::writeRootHistory().
|
inline |
Definition at line 249 of file pieceStand.h.
References osl::Move::player(), and previousStand().
|
inline |
Definition at line 78 of file pieceStand.h.
References flags, osl::isBasic(), mask, and shift.
Referenced by osl::game_playing::HistoryToTable::adjustDominance(), osl::ntesuki::NtesukiTable::allocateWithMove(), and trySub().
|
inline |
Definition at line 121 of file pieceStand.h.
References atMostOneKind(), carryUnchangedAfterSub(), flags, getFlags(), and testCarries().
Referenced by osl::hash::HashKey128::operator-=(), and osl::hash::GeneralHashKey< BoardKeyBase >::operator-=().
|
inline |
Definition at line 140 of file pieceStand.h.
References carryMask, and flags.
Referenced by add(), addAtmostOnePiece(), carryUnchangedAfterAdd(), carryUnchangedAfterSub(), osl::operator<(), osl::operator==(), and subAtmostOnePiece().
void osl::PieceStand::tryAdd | ( | Ptype | type) |
|
inline |
1枚以上持っていれば減らす
Definition at line 95 of file pieceStand.h.
References sub().
Referenced by osl::ntesuki::NtesukiRecord::calcProofPiecesOr(), and osl::ntesuki::NtesukiRecord::setDisproofPieces().
|
static |
Definition at line 45 of file pieceStand.h.
Referenced by carriesOff(), carriesOn(), isSuperiorOrEqualTo(), max(), max2(), and testCarries().
|
mutableprivate |
Definition at line 49 of file pieceStand.h.
Referenced by add(), addAtmostOnePiece(), any(), carriesOff(), carriesOn(), get(), getFlags(), isSuperiorOrEqualTo(), max(), max2(), sub(), subAtmostOnePiece(), and testCarries().
|
staticprivate |
Definition at line 48 of file pieceStand.h.
|
static |
持駒の表示で良く使われる順番.
KINGや成駒は -1
Definition at line 44 of file pieceStand.h.
Referenced by osl::checkmate::ProofPiecesUtil::addMonopolizedPieces(), osl::search::AlphaBeta2< EvalT >::alphaBetaSearchRoot(), osl::ntesuki::NtesukiRecord::calcProofPiecesAnd(), osl::eval::ml::PieceStand::eval(), osl::eval::ml::NonPawnPieceStandTurn::eval(), osl::search::AlphaBeta3::generateCapture(), osl::search::AlphaBeta3::generateCaptureAll(), osl::record::KisenPlusFile::getMoves(), osl::move_probability::SacrificeAttack::match(), osl::progress::ml::NewProgress::NewProgress(), osl::eval::ml::OpenMidEndingEval::OpenMidEndingEval(), osl::operator<<(), osl::record::KanjiPrint::print(), osl::search::AlphaBeta3::quiesce(), osl::search::AlphaBeta3::quiesceRoot(), osl::ntesuki::NtesukiRecord::setDisproofPieces(), osl::eval::ml::PieceStandY::setUp(), show(), osl::move_probability::MoveInfo::standIndex(), update(), and osl::progress::ml::NewProgress::updatePieceStand7().
|
staticprivate |
Definition at line 47 of file pieceStand.h.