My Project
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Friends | List of all members
osl::SimpleState Class Reference

#include <simpleState.h>

Inheritance diagram for osl::SimpleState:
osl::NumEffectState

Public Member Functions

 SimpleState ()
 
 SimpleState (Handicap h)
 
virtual ~SimpleState ()
 
void init ()
 盤面が空の状態に初期化
 
void init (Handicap h)
 ハンディに応じた初期状態に初期化
 
void initPawnMask ()
 
const Piece pieceOf (int num) const
 
void setPieceOf (int num, Piece p)
 
template<Player P>
const Piece kingPiece () const
 
const Piece kingPiece (Player P) const
 
template<Player P>
Square kingSquare () const
 
Square kingSquare (Player player) const
 
template<Ptype PTYPE>
const Piece nth (int n) const
 unpromote(PTYPE)のn番目の駒を帰す.
 
void setBoard (Square sq, Piece piece)
 
const PieceMaskstandMask (Player p) const
 
const PieceMaskusedMask () const
 
bool isOffBoard (int num) const
 
void clearPawn (Player pl, Square sq)
 (internal)
 
void setPawn (Player pl, Square sq)
 (internal)
 
bool isPawnMaskSet (Player player, int x) const
 
template<Player P>
bool isPawnMaskSet (int x) const
 
bool canDropPawnTo (Player player, int x) const
 xの筋に歩を打てる
 
void setPiece (Player player, Square sq, Ptype ptype)
 
void setPieceAll (Player player)
 
const Piece pieceAt (Square sq) const
 
const Piece operator[] (Square sq) const
 
const PiecegetPiecePtr (Square sq) const
 
const Piece pieceOnBoard (Square sq) const
 
bool isOnBoard (int num) const
 
int countPiecesOnStand (Player pl, Ptype ptype) const
 持駒の枚数を数える
 
template<Ptype Type>
int countPiecesOnStand (Player pl) const
 後方互換
 
bool hasPieceOnStand (Player player, Ptype ptype) const
 
template<Ptype T>
bool hasPieceOnStand (Player P) const
 
Piece nextPiece (Square cur, Offset diff) const
 diff方向にあるPiece を求める.
 
void setTurn (Player player)
 
Player turn () const
 
void changeTurn ()
 手番を変更する
 
bool isConsistent (bool show_error=true) const
 
template<bool show_error>
bool isAlmostValidMove (Move move) const
 エラー表示をするかどうかをtemplateパラメータにした高速化版
 
bool isAlmostValidMove (Move move, bool show_error=true) const
 合法手かどうかを簡単に検査する.局面に依存するチェックのみ. ルール上指せない手である可能性がある場合は,isValidMove を用いる.
 
bool isValidMove (Move move, bool show_error=true) const
 合法手かどうかを検査する. isValidMoveByRule, isAlmostValidMove をおこなう. 玉の素抜きや王手を防いでいるか, 千日手,打歩詰かどうかは検査しない.
 
bool isEmptyBetween (Square from, Square to, Offset offset, bool pieceExistsAtTo=false) const
 
bool isEmptyBetween (Square from, Square to, bool noSpaceAtTo=false) const
 
bool dump () const
 dump: 自分を cerr に表示する。abort 前などにデバッグに使う
 
const SimpleState emulateCapture (Piece from, Player new_owner) const
 from で表現されたPieceをnew_ownerの持駒にした局面を作る.
 
const SimpleState emulateHandPiece (Player from, Player to, Ptype ptype) const
 from からto に ptypeの持駒を一枚渡した局面を作る.
 
const SimpleState rotate180 () const
 
const SimpleState flipHorizontal () const
 

Static Public Member Functions

template<Ptype PTYPE>
static int nthLimit ()
 
static bool isValidMoveByRule (Move move, bool show_error)
 盤面以外の部分の反則のチェック
 

Static Public Attributes

static const bool hasPawnMask =true
 

Protected Member Functions

PieceMaskstandMask (Player p)
 
template<bool show_error>
bool isAlmostValidDrop (Move move) const
 
template<bool show_error>
bool testValidityOtherThanEffect (Move move) const
 

Protected Attributes

CArray< Piece, Square::SIZEboard
 
CArray< Piece, Piece::SIZEpieces
 全てのpieceが登録されている
 
CArray< PieceMask, 2 > stand_mask
 
CArray< BitXmask, 2 > pawnMask
 
CArray< CArray< char, PTYPE_SIZE-PTYPE_BASIC_MIN >, 2 > stand_count
 
Player player_to_move
 手番
 
PieceMask used_mask
 

Private Types

typedef SimpleState state_t
 

Private Member Functions

int countPiecesOnStandBit (Player pl, Ptype ptype) const
 

Friends

std::ostream & operator<< (std::ostream &os, const SimpleState &state)
 
bool operator== (const SimpleState &st1, const SimpleState &st2)
 盤上の駒のみを比較する(持ち駒は見ない).
 

Detailed Description

Definition at line 34 of file simpleState.h.

Member Typedef Documentation

◆ state_t

Definition at line 39 of file simpleState.h.

Constructor & Destructor Documentation

◆ SimpleState() [1/2]

osl::SimpleState::SimpleState ( )
explicit

Definition at line 12 of file simpleState.cc.

References init().

◆ SimpleState() [2/2]

osl::SimpleState::SimpleState ( Handicap  h)
explicit

Definition at line 16 of file simpleState.cc.

◆ ~SimpleState()

osl::SimpleState::~SimpleState ( )
virtual

Definition at line 112 of file simpleState.cc.

Member Function Documentation

◆ canDropPawnTo()

bool osl::SimpleState::canDropPawnTo ( Player  player,
int  x 
) const
inline

◆ changeTurn()

void osl::SimpleState::changeTurn ( )
inline

◆ clearPawn()

void osl::SimpleState::clearPawn ( Player  pl,
Square  sq 
)
inline

(internal)

Definition at line 138 of file simpleState.h.

References pawnMask.

Referenced by osl::NumEffectState::doUndoSimpleMove().

◆ countPiecesOnStand() [1/2]

template<Ptype Type>
int osl::SimpleState::countPiecesOnStand ( Player  pl) const
inline

後方互換

Definition at line 188 of file simpleState.h.

References countPiecesOnStand().

◆ countPiecesOnStand() [2/2]

int osl::SimpleState::countPiecesOnStand ( Player  pl,
Ptype  ptype 
) const
inline

◆ countPiecesOnStandBit()

int osl::SimpleState::countPiecesOnStandBit ( Player  pl,
Ptype  ptype 
) const
inlineprivate

Definition at line 199 of file simpleState.h.

References osl::PtypeTable::getMaskLow(), osl::Ptype_Table, and standMask().

◆ dump()

bool osl::SimpleState::dump ( ) const

dump: 自分を cerr に表示する。abort 前などにデバッグに使う

Definition at line 450 of file simpleState.cc.

◆ emulateCapture()

const osl::SimpleState osl::SimpleState::emulateCapture ( Piece  from,
Player  new_owner 
) const

from で表現されたPieceをnew_ownerの持駒にした局面を作る.

Definition at line 460 of file simpleState.cc.

References initPawnMask(), osl::Piece::owner(), osl::Piece::ptype(), setPiece(), setTurn(), osl::Piece::square(), osl::Square::STAND(), and osl::unpromote().

◆ emulateHandPiece()

const osl::SimpleState osl::SimpleState::emulateHandPiece ( Player  from,
Player  to,
Ptype  ptype 
) const

from からto に ptypeの持駒を一枚渡した局面を作る.

Definition at line 480 of file simpleState.cc.

References osl::alt(), initPawnMask(), osl::Piece::isOnBoard(), osl::Piece::owner(), osl::Piece::ptype(), setPiece(), setTurn(), osl::Piece::square(), and osl::Square::STAND().

◆ flipHorizontal()

const osl::SimpleState osl::SimpleState::flipHorizontal ( ) const

◆ getPiecePtr()

const Piece * osl::SimpleState::getPiecePtr ( Square  sq) const
inline

◆ hasPieceOnStand() [1/2]

template<Ptype T>
bool osl::SimpleState::hasPieceOnStand ( Player  P) const
inline

Definition at line 195 of file simpleState.h.

References countPiecesOnStand().

◆ hasPieceOnStand() [2/2]

bool osl::SimpleState::hasPieceOnStand ( Player  player,
Ptype  ptype 
) const
inline

Definition at line 191 of file simpleState.h.

References countPiecesOnStand().

Referenced by osl::checkmate::ProofPiecesUtil::addMonopolizedPieces(), osl::eval::ml::AttackMajorsInBase::addOne(), osl::move_probability::MoveInfo::adhocAdjustBishopFork(), osl::rating::BadLance::basicMatch(), osl::eval::ml::KnightCheck::canCheck(), osl::rating::Threatmate::captureForKnightCheck(), osl::checkmate::ProofNumberTable::disproofAfterAllCheck(), osl::checkmate::CheckmateIfCapture::effectiveAttackCandidate0(), osl::eval::ml::BishopStandFile5::eval(), osl::eval::ml::PawnDropBoth::eval(), osl::eval::ml::KnightHead::eval(), osl::eval::ml::PieceStandCombinationBoth::eval(), osl::eval::ml::KnightFork::eval(), osl::eval::ml::BishopRookFork::eval(), osl::eval::ml::SilverFork::eval(), osl::eval::ml::NoPawnOnStand::eval(), osl::eval::ml::KingMobility::evalOne(), osl::eval::ml::BishopRookFork::evalOne(), osl::eval::ml::King25Effect3::evalOne(), osl::eval::ml::KnightFork::evalWithUpdate(), osl::eval::ml::PawnDropBoth::evalWithUpdate(), osl::move_probability::StateInfo::findCheckmateDefender(), osl::move_probability::StateInfo::findShortThreatmate(), osl::rating::Threatmate::isCandidate(), osl::checkmate::ProofNumberTable::libertyAfterAllDrop(), osl::move_probability::CheckmateIfCapture::match(), osl::move_probability::CoverPawn::match(), osl::move_probability::OpposingPawn::match(), osl::move_probability::DropAfterOpposingPawn::match(), osl::eval::ml::OpenMidEndingEval::suggestMove(), and osl::progress::ml::NewProgress::updatePieceStand7().

◆ init() [1/2]

void osl::SimpleState::init ( )

◆ init() [2/2]

void osl::SimpleState::init ( Handicap  h)

ハンディに応じた初期状態に初期化

Definition at line 67 of file simpleState.cc.

References osl::BISHOP, osl::BLACK, osl::GOLD, osl::HIRATE, osl::KING, osl::KNIGHT, osl::LANCE, osl::PAWN, osl::ROOK, osl::SILVER, and osl::WHITE.

◆ initPawnMask()

void osl::SimpleState::initPawnMask ( )

◆ isAlmostValidDrop()

template<bool show_error>
bool osl::SimpleState::isAlmostValidDrop ( Move  move) const
protected

◆ isAlmostValidMove() [1/2]

template<bool show_error>
bool osl::SimpleState::isAlmostValidMove ( Move  move) const

◆ isAlmostValidMove() [2/2]

bool osl::SimpleState::isAlmostValidMove ( Move  move,
bool  show_error = true 
) const

合法手かどうかを簡単に検査する.局面に依存するチェックのみ. ルール上指せない手である可能性がある場合は,isValidMove を用いる.

局面に依存する検査でも,玉の素抜きや王手を防いでいるか, 千日手,打歩詰かどうかは検査しない.

Definition at line 318 of file simpleState.cc.

◆ isConsistent()

bool osl::SimpleState::isConsistent ( bool  show_error = true) const

◆ isEmptyBetween() [1/2]

bool osl::SimpleState::isEmptyBetween ( Square  from,
Square  to,
bool  noSpaceAtTo = false 
) const
inline
Parameters
from- マスの位置
to- マスの位置 fromとtoがクイーンで利きがある位置関係にあるという前提 で,間が全部空白かをチェック

Definition at line 293 of file simpleState.h.

References osl::Board_Table, osl::BoardTable::getShortOffset(), isEmptyBetween(), osl::Square::isOnBoard(), and osl::Offset::zero().

◆ isEmptyBetween() [2/2]

bool osl::SimpleState::isEmptyBetween ( Square  from,
Square  to,
Offset  offset,
bool  pieceExistsAtTo = false 
) const
inline
Parameters
from- マスの位置
to- マスの位置
offset- fromからtoへのshort offset fromとtoがクイーンで利きがある位置関係にあるという前提 で,間が全部空白かをチェック
pieceExistsAtTo- toに必ず駒がある (toが空白でも動く)

Definition at line 267 of file simpleState.h.

References osl::Board_Table, osl::BoardTable::getShortOffset(), osl::Piece::isEmpty(), osl::Square::isOnBoard(), pieceAt(), and osl::Offset::zero().

Referenced by osl::effect_util::Neighboring8Direct::Table::findNearest(), osl::effect_util::Neighboring8Direct::Table::hasEffect(), osl::NumEffectState::hasEffectIf(), osl::move_probability::BreakThreatmate::isDefendingThreatmate(), isEmptyBetween(), osl::move_classifier::KingOpenMove< P >::isMemberMain(), and osl::eval::ml::BishopRookFork::testCenter().

◆ isOffBoard()

bool osl::SimpleState::isOffBoard ( int  num) const
inline

Definition at line 132 of file simpleState.h.

References osl::BLACK, standMask(), osl::PieceMask::test(), and osl::WHITE.

◆ isOnBoard()

bool osl::SimpleState::isOnBoard ( int  num) const
inline

◆ isPawnMaskSet() [1/2]

template<Player P>
bool osl::SimpleState::isPawnMaskSet ( int  x) const
inline

Definition at line 152 of file simpleState.h.

References isPawnMaskSet().

Referenced by isPawnMaskSet().

◆ isPawnMaskSet() [2/2]

bool osl::SimpleState::isPawnMaskSet ( Player  player,
int  x 
) const
inline

◆ isValidMove()

bool osl::SimpleState::isValidMove ( Move  move,
bool  show_error = true 
) const

合法手かどうかを検査する. isValidMoveByRule, isAlmostValidMove をおこなう. 玉の素抜きや王手を防いでいるか, 千日手,打歩詰かどうかは検査しない.

Definition at line 435 of file simpleState.cc.

References osl::Move::isValid(), and osl::Move::player().

Referenced by osl::record::KisenUtils::convertMove(), osl::record::CsaFile::makeInfo(), osl::usi::parse(), osl::csa::CsaFileMinimal::parseLine(), and osl::kakinoki::KakinokiFile::parseLine().

◆ isValidMoveByRule()

bool osl::SimpleState::isValidMoveByRule ( Move  move,
bool  show_error 
)
static

◆ kingPiece() [1/2]

template<Player P>
const Piece osl::SimpleState::kingPiece ( ) const
inline

◆ kingPiece() [2/2]

const Piece osl::SimpleState::kingPiece ( Player  P) const
inline

Definition at line 86 of file simpleState.h.

References osl::BLACK, and osl::isValid().

◆ kingSquare() [1/2]

template<Player P>
Square osl::SimpleState::kingSquare ( ) const
inline

Definition at line 94 of file simpleState.h.

References osl::Square::square.

Referenced by osl::eval::ml::PiecePairKing::add(), osl::eval::ml::MajorCheckWithCapture::addOne(), osl::eval::ml::PiecePairKing::addSub(), osl::move_probability::MoveInfo::adhocAdjustBishopFork(), osl::eval::ml::RookMobilityAll::adjust(), osl::checkmate::Dfpn::analyze(), osl::progress::ml::NewProgress::attack5x5Value(), osl::checkmate::ProofNumberTable::attackEstimation(), osl::checkmate::FixedDepthSolverExt::SetProofPieces::attackEstimation(), osl::eval::ml::KnightCheck::canCheck(), osl::enter_king::EnterKing::canDeclareWin(), osl::enter_king::EnterKing::canDeclareWin(), osl::checkmate::CheckmateIfCapture::cannotCapture(), osl::rating::DefenseKing8::count(), osl::eval::ml::King25Effect::countEffectAndPieces(), osl::checkmate::ProofNumberTable::countLiberty(), osl::checkmate::King8Info::countMoveCandidate(), osl::eval::ml::OpenMidEndingEval::debugInfo(), osl::progress::Effect5x3::Effect5x3(), osl::progress::Effect5x3WithBonus::Effect5x3WithBonus(), osl::checkmate::CheckmateIfCapture::effectiveAttackCandidate0(), osl::eval::ml::King8Effect::effectState(), osl::eval::ml::King8EffectAll::effectState(), osl::eval::ml::KingXBothBlocked::eval(), osl::eval::ml::KingXBlocked3::eval(), osl::eval::ml::KingPieceRelative::eval(), osl::eval::ml::KingPieceRelativeNoSupport::eval(), osl::eval::ml::PtypeYY::eval(), osl::eval::ml::RookEffectBase::eval(), osl::eval::ml::BishopEffectBase::eval(), osl::eval::ml::BishopHead::eval(), osl::eval::ml::NumPiecesBetweenBishopAndKing::eval(), osl::eval::ml::PawnDropBoth::eval(), osl::eval::ml::SilverFeatures::eval(), osl::eval::ml::GoldFeatures::eval(), osl::eval::ml::KnightCheck::eval(), osl::eval::ml::LanceEffectPieceKingRelative::eval(), osl::eval::ml::SilverAdvance26::eval(), osl::eval::ml::PieceStandY::eval(), osl::eval::ml::RookPawnY::eval(), osl::eval::ml::PtypeCount::eval(), osl::eval::ml::King25Mobility::eval(), osl::eval::ml::KingXBlockedBase::eval(), osl::eval::ml::KingXBlockedYBase::eval(), osl::eval::ml::King25EffectY::eval(), osl::eval::ml::King25EffectY2::eval(), osl::eval::ml::King25EffectYAttack::eval(), osl::eval::ml::King25EffectYDefense::eval(), osl::eval::ml::NonPawnAttacked::eval(), osl::eval::ml::Pin::eval(), osl::eval::ml::PiecePairKing::evalOne(), osl::eval::ml::PinPtypeAll::evalOne(), osl::eval::ml::CheckShadowPtype::evalOne(), osl::eval::ml::AnagumaEmpty::evalOne(), osl::eval::ml::KingMobility::evalOne(), osl::eval::ml::KingMobilitySum::evalOne(), osl::eval::ml::King25EmptyAbs< Opening >::evalOne(), osl::eval::ml::King25EffectEach< Stage >::evalOne(), osl::eval::ml::EnterKingDefense::evalOne(), osl::eval::ml::KingRookBishop::evalOne(), osl::eval::ml::GoldAndSilverNearKing::evalOne(), osl::eval::ml::King25BothSide::evalOne(), osl::eval::ml::GoldFeatures::evalOne(), osl::eval::ml::PromotedMinorPieces::evalOne(), osl::eval::ml::BishopExchangeSilverKing::evalOne(), osl::eval::ml::King25EffectEachBoth::evalOne(), osl::eval::ml::King3Pieces::evalOne(), osl::eval::ml::King25Effect3::evalOne(), osl::eval::ml::King25EffectCountCombination::evalOne(), osl::eval::ml::King25EmptySquareNoEffect::evalWithUpdate(), osl::eval::ml::King3Pieces::evalWithUpdate(), osl::eval::ml::King25EffectEachBoth::evalWithUpdate(), osl::eval::ml::KingPieceRelativeNoSupport::evalWithUpdate(), osl::eval::ml::PieceStandY::evalWithUpdate(), osl::eval::ml::PtypeYY::evalWithUpdate(), osl::eval::ml::PawnDropBoth::evalWithUpdate(), osl::eval::ml::King25EmptyAbs< Opening >::evalWithUpdate(), osl::eval::ml::PtypeCount::evalWithUpdateBang(), osl::eval::ml::KingXBlockedYBase::evalWithUpdateBang(), osl::eval::ml::PiecePairKing::evalWithUpdateBang(), osl::eval::ml::NonPawnAttacked::evalWithUpdateBang(), osl::eval::ml::King8EffectBase::evalWithUpdateCommon(), osl::eval::ml::King8EffectBase::evalWithUpdateCommon(), osl::move_probability::StateInfo::findCheckmateDefender(), osl::NumEffectState::findCheckPiece(), osl::rating::AttackKing8Group::findMatch(), osl::move_probability::StateInfo::findShortThreatmate(), osl::checkmate::Dfpn::generateCheck(), osl::effect_util::Neighboring8Direct::Table::hasEffectOrAdditional(), osl::checkmate::Dfpn::hasEscapeMove(), osl::checkmate::King8Info::hasMoveCandidate(), osl::NumEffectState::inCheck(), osl::rating::Karanari::index(), osl::rating::BigramAttack::index(), osl::eval::ml::KingPieceRelative::index(), osl::NumEffectState::inUnblockableCheck(), osl::eval::ml::KingXBlockedBase::isBlocked(), osl::rating::Threatmate::isCandidate(), osl::move_classifier::KingOpenMove< P >::isMember(), osl::checkmate::ProofNumberTable::libertyAfterAllMove(), osl::rating::RatingEnv::make(), osl::checkmate::King8Info::make(), osl::progress::Effect5x3WithBonus::makeEffectMask(), osl::move_probability::BlockLong::makeLongAttackOne(), osl::rating::RelativeKingX::makeOldX(), osl::rating::RelativeKingY::makeOldY(), osl::progress::Effect5x3::makeProgress(), osl::progress::Effect5x3d::makeProgress(), osl::checkmate::King8Info::makeWithPin(), osl::rating::RelativeKingX::makeX(), osl::rating::RelativeKingY::makeY(), osl::rating::Karanari::match(), osl::rating::AttackKing8::match(), osl::move_probability::LureDefender::match(), osl::move_probability::BreakThreatmate::match(), osl::move_probability::CheckmateIfCapture::match(), osl::move_probability::SacrificeAttack::match(), osl::move_probability::King5x5Ptype::match(), osl::move_probability::KingBlockade::match(), osl::move_probability::PromotionBySacrifice::match(), osl::move_probability::EscapeThreatened::match(), osl::move_probability::KingRelativeY::match(), osl::move_probability::KingRelativeX::match(), osl::move_probability::OpposingPawn::match(), osl::move_probability::DropAfterOpposingPawn::match(), osl::move_probability::LanceAttack::match(), osl::rating::DefenseKing8::matchDrop(), osl::rating::Karanari::matchGeneral(), osl::rating::DefenseKing8::matchMove(), osl::checkmate::King8Info::moveCandidateMask(), osl::eval::ml::OpenMidEndingEval::OpenMidEndingEval(), osl::eval::ml::King8EffectBase::MakeEffectStateSimple::operator()(), osl::eval::ml::King8EffectBase::MakeEffectStateDefense::operator()(), osl::progress::ml::NewProgress::progressOne(), osl::NumEffectState::recalcPinOpen(), osl::move_probability::CheckFeature::sign(), osl::eval::ml::PiecePairKing::sub(), osl::progress::Effect5x3::update(), osl::progress::Effect5x3WithBonus::update(), osl::progress::Effect5x3d::update(), osl::progress::ml::NewProgress::updateAttack5x5PiecesAndState(), osl::move_probability::PatternCommon::updateCacheOne(), osl::eval::ml::NonPawnAttacked::updateEffectChanged(), osl::eval::ml::OpenMidEndingEval::updateGoldSilverNearKing(), osl::progress::ml::NewProgress::updateMain(), osl::progress::ml::NewProgress::updatePieceKingRelativeBonus(), osl::eval::ml::OpenMidEndingEval::updateSub(), and osl::progress::ml::NewProgress::updateSub().

◆ kingSquare() [2/2]

Square osl::SimpleState::kingSquare ( Player  player) const
inline

Definition at line 97 of file simpleState.h.

References osl::BLACK, and osl::isValid().

◆ nextPiece()

Piece osl::SimpleState::nextPiece ( Square  cur,
Offset  diff 
) const
inline

diff方向にあるPiece を求める.

Returns
盤外ならPTYPE_EDGE

Definition at line 208 of file simpleState.h.

References osl::Piece::EMPTY(), pieceAt(), and osl::Offset::zero().

Referenced by osl::effect_util::AdditionalEffect::find(), osl::rating::PatternLong2::find(), and osl::eval::See::findAdditionalPieces().

◆ nth()

template<Ptype PTYPE>
const Piece osl::SimpleState::nth ( int  n) const
inline

unpromote(PTYPE)のn番目の駒を帰す.


駒番号に依存するので順番は不定.

Definition at line 114 of file simpleState.h.

References pieceOf().

Referenced by osl::eval::ml::BishopExchangeSilverKing::eval(), osl::eval::ml::AttackMajorsInBase::eval(), and osl::eval::ml::BishopExchangeSilverKing::evalOne().

◆ nthLimit()

template<Ptype PTYPE>
static int osl::SimpleState::nthLimit ( )
inlinestatic

◆ operator[]()

const Piece osl::SimpleState::operator[] ( Square  sq) const
inline

Definition at line 168 of file simpleState.h.

References pieceAt().

◆ pieceAt()

const Piece osl::SimpleState::pieceAt ( Square  sq) const
inline
Parameters
sqは isOnboardを満たす Square の12近傍(8近傍+桂馬の利き) ! isOnBoard(sq) の場合は PIECE_EDGE を返す

Definition at line 167 of file simpleState.h.

References board, and osl::Square::index().

Referenced by osl::move_probability::BishopAttack::addOne(), osl::move_probability::PatternCommon::addOne(), osl::move_probability::AddEffectLong::addOne(), osl::move_probability::MoveInfo::adhocAdjustSlider(), osl::progress::Effect5x3WithBonus::attackEffect3(), osl::eval::ml::KnightCheck::canCheck(), osl::move_classifier::PawnDropCheckmate< P >::canEscape(), osl::eval::ml::GoldFeatures::canMoveToSide(), osl::eval::ml::GoldFeatures::canRetreat(), osl::eval::ml::SilverFeatures::canRetreat(), osl::eval::ml::KnightAdvance::cantAdvance(), osl::eval::ml::PawnAdvanceUtil::cantAdvance(), osl::rating::Threatmate::captureForKnightCheck(), osl::eval::See::computeValue(), osl::record::KisenUtils::convertMove(), osl::rating::DefenseKing8::count(), osl::mobility::BishopMobility::countAll(), osl::mobility::LanceMobility::countAll(), osl::mobility::BishopMobility::countAllDir(), osl::eval::ml::NumPiecesBetweenBishopAndKing::countBetween(), osl::mobility::RookMobility::countHorizontalAll(), osl::mobility::countMobilityBoth(), osl::mobility::RookMobility::countVerticalAll(), osl::effect_action::AlwaysMove< Action >::doAction(), osl::effect_action::BetterToPromote< Action >::doAction(), osl::rating::ImmediateAddSupport::Test::doAction(), osl::effect_action::AlwaysMove< Action >::doActionPtype(), osl::effect_action::BetterToPromote< Action >::doActionPtype(), osl::effect::NumSimpleEffectTable::doBlockAt(), osl::effect::NumSimpleEffectTable::doEffectLong(), osl::effect::NumSimpleEffectTable::doEffectShort(), osl::effect::EffectedNumTable::EffectedNumTable(), osl::checkmate::CheckmateIfCapture::effectiveAttackCandidate0(), osl::eval::ml::King8Effect::effectState(), osl::eval::ml::King8EffectAll::effectState(), osl::eval::ml::RookPromoteDefense::eval(), osl::eval::ml::BishopHead::eval(), osl::eval::ml::BishopBishopPiece::eval(), osl::eval::ml::RookRookPiece::eval(), osl::eval::ml::BishopStandFile5::eval(), osl::eval::ml::KnightHead::eval(), osl::eval::ml::PawnPtypeOPtypeO::eval(), osl::eval::ml::LanceEffectPieceKingRelative::eval(), osl::eval::ml::SilverAdvance26::eval(), osl::eval::ml::AnagumaEmpty::evalOne(), osl::eval::ml::King25EmptyAbs< Opening >::evalOne(), osl::eval::ml::EnterKingDefense::evalOne(), osl::eval::ml::King25EmptySquareNoEffect::evalOne(), osl::eval::ml::King25EmptySquareNoEffect::evalOne(), osl::eval::ml::GoldFeatures::evalOne(), osl::eval::ml::SilverFeatures::evalOne(), osl::eval::ml::King3Pieces::evalOne(), osl::eval::ml::BishopEffectBase::evalOne(), osl::eval::ml::RookEffectBase::evalOne(), osl::eval::ml::PawnPtypeOPtypeO::evalWithUpdate(), osl::eval::ml::KingPieceRelativeNoSupport::evalWithUpdate(), osl::eval::ml::PiecePair::evalWithUpdate(), osl::eval::ml::PtypeYPawnY::evalWithUpdateBang(), osl::eval::ml::NonPawnAttackedPtype::evalWithUpdateBang(), osl::eval::ml::NonPawnAttacked::evalWithUpdateBang(), osl::eval::ml::PawnAdvanceAll::evalWithUpdateBang(), osl::effect_util::SendOffSquare::find(), osl::move_probability::StateInfo::findCheckmateDefender(), osl::eval::ml::BishopRookFork::findDropInLine(), osl::rating::AttackKing8Group::findMatch(), osl::rating::PatternGroup::findMatch(), osl::NumEffectState::forEachEffectOfPieceDir(), osl::NumEffectState::forEachEffectOfPieceLongDir(), osl::checkmate::Dfpn::generateCheck(), osl::checkmate::King8Info::hasEffectMask(), osl::effect_util::Neighboring8Direct::Table::hasEffectOrAdditional(), osl::eval::ml::King25EffectEach< Stage >::index(), osl::eval::ml::King25EffectEachBoth::index(), osl::eval::ml::KingXBlockedBase::isBlocked(), isEmptyBetween(), osl::move_classifier::KingOpenMove< P >::isMember(), osl::move_classifier::KingOpenMove< P >::isMemberMain(), osl::record::KisenPlusFile::load(), osl::move_probability::BlockLong::makeLongAttackOne(), osl::NumEffectState::makePinOpenDir(), osl::NumEffectState::makeUnmakeMove(), osl::rating::AttackKing8::match(), osl::rating::Pattern::match(), osl::move_probability::CoverPawn::match(), osl::move_probability::OpposingPawn::match(), osl::move_probability::LanceAttack::match(), osl::eval::ml::SilverFork::matchGold(), osl::eval::ml::SilverFork::matchRook(), osl::mobility::MobilityTable::MobilityTable(), nextPiece(), osl::rating::PatternLong::nextPieceOrEnd(), osl::effect_util::SendOffSquare::onlyOneSupport(), osl::eval::ml::King8EffectBase::MakeEffectStateSimple::operator()(), osl::eval::ml::King8EffectBase::MakeEffectStateDefense::operator()(), osl::operator==(), operator[](), osl::eval::ml::PinPtypeAll::pawnAttack(), pieceOnBoard(), osl::eval::ml::PiecePair::pieceValueDouble(), osl::NumEffectState::recalcPinOpen(), osl::ki2::show(), osl::move_probability::PawnAttack::squareStatus(), osl::csa::strToMove(), osl::move_probability::ToEffect::supportAttack(), osl::eval::ml::BishopRookFork::testCenter(), and osl::move_probability::PatternCommon::updateCacheOne().

◆ pieceOf()

const Piece osl::SimpleState::pieceOf ( int  num) const
inline

Definition at line 76 of file simpleState.h.

References pieces.

Referenced by osl::eval::ml::PiecePairKing::add(), osl::eval::ml::MajorCheckWithCapture::addOne(), osl::eval::ml::PiecePairKing::addSub(), osl::checkmate::OracleAdjust::attack(), osl::book::CompactBoard::CompactBoard(), osl::effect_util::AdditionalOrShadow::count(), osl::effect::NumSimpleEffectTable::doBlockAt(), osl::effect::EffectedNumTable::EffectedNumTable(), osl::checkmate::CheckmateIfCapture::effectiveAttackCandidate0(), osl::eval::ml::PiecePair::eval(), osl::eval::ml::RookMobilityAll::eval(), osl::eval::ml::BishopMobilityAll::eval(), osl::eval::ml::LanceMobilityAll::eval(), osl::eval::ml::KingPieceRelative::eval(), osl::eval::ml::KingPieceRelativeNoSupport::eval(), osl::eval::ml::PtypeYY::eval(), osl::eval::ml::MajorY< Opening, MajorBasic >::eval(), osl::eval::ml::RookPawn< Opening >::eval(), osl::eval::ml::RookEffectBase::eval(), osl::eval::ml::RookPromoteDefense::eval(), osl::eval::ml::BishopEffectBase::eval(), osl::eval::ml::BishopHead::eval(), osl::eval::ml::NumPiecesBetweenBishopAndKing::eval(), osl::eval::ml::BishopBishopPiece::eval(), osl::eval::ml::RookRook::eval(), osl::eval::ml::RookRookPiece::eval(), osl::eval::ml::RookSilverKnight::eval(), osl::eval::ml::BishopSilverKnight::eval(), osl::eval::ml::PawnAdvance::eval(), osl::eval::ml::SilverFeatures::eval(), osl::eval::ml::GoldFeatures::eval(), osl::eval::ml::KnightAdvance::eval(), osl::eval::ml::PtypeY::eval(), osl::eval::ml::PtypeX::eval(), osl::eval::ml::KnightHead::eval(), osl::eval::ml::PawnPtypeOPtypeO::eval(), osl::eval::ml::LanceEffectPieceKingRelative::eval(), osl::eval::ml::PieceEval::eval(), osl::eval::ml::NonPawnAttackedPtype::eval(), osl::eval::ml::BishopRookFork::eval(), osl::eval::ml::SilverFork::eval(), osl::eval::ml::RookPawnY::eval(), osl::eval::ml::PtypeYPawnY::eval(), osl::eval::ml::NonPawnAttacked::eval(), osl::eval::ml::Pin::eval(), osl::eval::ml::SimplePin::eval(), osl::eval::ml::PiecePairKing::evalOne(), osl::eval::ml::PinPtypeAll::evalOne(), osl::eval::ml::CheckShadowPtype::evalOne(), osl::eval::ml::MajorGoldSilverAttacked< Opening >::evalOne(), osl::eval::ml::KingRookBishop::evalOne(), osl::eval::ml::NonPawnAttackedPtypePair::evalOne(), osl::eval::ml::KnightFork::evalOne(), osl::eval::ml::PromotedMinorPieces::evalOne(), osl::eval::ml::King25Effect3::evalOne(), osl::eval::ml::KingPieceRelativeNoSupport::evalWithUpdate(), osl::eval::ml::NonPawnAttackedPtype::evalWithUpdateBang(), osl::move_probability::BlockLong::findAll(), osl::NumEffectState::findAttackAt(), osl::NumEffectState::findAttackAtStrict(), osl::NumEffectState::findAttackNotBy(), osl::NumEffectState::findLongAttackAt(), osl::NumEffectState::forEachEffect(), osl::NumEffectState::forEachOnBoard(), osl::NumEffectState::forEachOnBoardPtypeStrict(), osl::effect_util::AdditionalEffect::hasEffect(), osl::NumEffectState::hasEffectAt(), osl::NumEffectState::hasEffectInDirection(), osl::hash::HashKey::HashKey(), osl::rating::ImmediateAddSupport::index(), osl::rating::PinAttack::index(), osl::effect::NumSimpleEffectTable::init(), osl::NumEffectState::isConsistent(), osl::move_probability::BreakThreatmate::isDefendingKing8(), isOnBoard(), kingPiece(), osl::checkmate::ProofNumberTable::libertyAfterAllMove(), osl::move_probability::MoveFromOpposingSliders::longPtype(), osl::checkmate::King8Info::make(), osl::rating::RookDefense::match(), osl::rating::PinAttack::match(), osl::move_probability::CoverFork::match(), osl::move_probability::PromotionBySacrifice::match(), osl::book::MiniBoard::MiniBoard(), osl::book::MiniBoardChar50::MiniBoardChar50(), osl::mobility::MobilityTable::MobilityTable(), nth(), osl::NumEffectState::NumEffectState(), osl::eval::ml::OpenMidEndingEval::OpenMidEndingEval(), osl::NumEffectState::pinAttacker(), osl::progress::PtypeProgress::PtypeProgress(), osl::record::myshogi::show(), osl::ki2::show(), osl::eval::ml::PiecePairKing::sub(), osl::move_probability::BlockLong::updateCache(), osl::eval::ml::NonPawnAttackedPtype::updateChanged(), osl::eval::ml::NonPawnAttacked::updateEffectChanged(), osl::eval::ml::OpenMidEndingEval::updateGoldSilverNearKing(), osl::progress::ml::NewProgress::updateNonPawnAttackedPtypePairOne(), osl::progress::ml::NewProgress::updatePawnFacing(), and osl::progress::ml::NewProgress::updatePieceKingRelativeBonus().

◆ pieceOnBoard()

const Piece osl::SimpleState::pieceOnBoard ( Square  sq) const
inline

◆ rotate180()

const osl::SimpleState osl::SimpleState::rotate180 ( ) const

◆ setBoard()

void osl::SimpleState::setBoard ( Square  sq,
Piece  piece 
)
inline

Definition at line 119 of file simpleState.h.

References board, and osl::Square::index().

◆ setPawn()

void osl::SimpleState::setPawn ( Player  pl,
Square  sq 
)
inline

(internal)

Definition at line 142 of file simpleState.h.

References pawnMask.

Referenced by osl::NumEffectState::doUndoSimpleMove().

◆ setPiece()

void osl::SimpleState::setPiece ( Player  player,
Square  sq,
Ptype  ptype 
)

◆ setPieceAll()

void osl::SimpleState::setPieceAll ( Player  player)

◆ setPieceOf()

void osl::SimpleState::setPieceOf ( int  num,
Piece  p 
)
inline

Definition at line 79 of file simpleState.h.

References pieces.

◆ setTurn()

void osl::SimpleState::setTurn ( Player  player)
inline

◆ standMask() [1/2]

PieceMask & osl::SimpleState::standMask ( Player  p)
inlineprotected

◆ standMask() [2/2]

const PieceMask & osl::SimpleState::standMask ( Player  p) const
inline

Definition at line 128 of file simpleState.h.

References stand_mask.

◆ testValidityOtherThanEffect()

template<bool show_error>
bool osl::SimpleState::testValidityOtherThanEffect ( Move  move) const
protected

◆ turn()

Player osl::SimpleState::turn ( ) const
inline

Definition at line 220 of file simpleState.h.

References player_to_move.

Referenced by osl::rating::BradleyTerry::accumulate(), osl::move_probability::BishopAttack::addOne(), osl::rating::BradleyTerry::addSquare(), osl::move_probability::MoveInfo::adhocAdjustBishopFork(), osl::checkmate::Dfpn::analyze(), osl::checkmate::ProofNumberTable::attackEstimation(), osl::move_probability::KingBlockade::blockAll(), osl::rating::DefenseKing8::blocking(), osl::enter_king::EnterKing::canDeclareWin(), osl::enter_king::EnterKing::canDeclareWin(), osl::checkmate::CheckmateIfCapture::cannotCapture(), osl::rating::Threatmate::captureForKnightCheck(), osl::book::CompactBoard::CompactBoard(), osl::record::KisenUtils::convertMove(), osl::rating::DefenseKing8::count(), osl::rating::CountEffect2::count(), osl::move_probability::CoverFork::defending(), osl::rating::ImmediateAddSupport::Test::doAction(), osl::checkmate::CheckmateIfCapture::effectiveAttack(), osl::checkmate::CheckmateIfCapture::effectiveAttackCandidate0(), osl::rating::PatternBlock::find(), osl::rating::AttackKing8Group::findMatch(), osl::rating::PatternBlockGroup::findMatch(), osl::rating::BlockGroup::findMatch(), osl::rating::ChaseGroup::findMatch(), osl::checkmate::DualDfpn::findProof(), osl::checkmate::DualDfpn::findProof(), osl::move_probability::StateInfo::findShortThreatmate(), osl::Move::fromMove16(), osl::GenerateEscapeKing::generate(), osl::move_generator::GenerateEscapeOfTurn::generate(), osl::move_generator::GenerateCapture::generate(), osl::GenerateEscapeKing::generateCheap(), osl::rating::FeatureSet::generateRating(), osl::checkmate::Dfpn::hasCheckmateMove(), osl::checkmate::FixedDepthSearcher::hasCheckmateMoveOfTurn(), osl::checkmate::Dfpn::hasEscapeMove(), osl::hash::HashKey::HashKey(), osl::NumEffectState::inCheck(), osl::rating::Karanari::index(), osl::rating::ImmediateAddSupport::index(), osl::rating::PinAttack::index(), osl::rating::BigramAttack::index(), osl::eval::ml::MajorGoldSilverAttacked< Opening >::index(), osl::rating::Threatmate::isCandidate(), osl::move_probability::BreakThreatmate::isDefendingKing8(), osl::checkmate::DualDfpn::isLosingState(), osl::rating::Threatmate::knight2Step(), osl::checkmate::ProofPieces::leaf(), osl::checkmate::DisproofPieces::leaf(), osl::checkmate::ProofNumberTable::libertyAfterAllDrop(), osl::checkmate::ProofNumberTable::libertyAfterAllDrop(), osl::checkmate::ProofNumberTable::libertyAfterAllMove(), osl::record::KisenPlusFile::load(), osl::rating::RatingEnv::make(), osl::rating::RatingEnv::make(), osl::record::CsaFile::makeInfo(), osl::move_probability::BlockLong::makeLongAttackOne(), osl::NumEffectState::makeUnmakeMove(), osl::rating::Block::match(), osl::rating::Karanari::match(), osl::rating::Chase::match(), osl::rating::AttackKing8::match(), osl::rating::PinAttack::match(), osl::move_probability::LureDefender::match(), osl::move_probability::PromotionBySacrifice::match(), osl::rating::DefenseKing8::matchDrop(), osl::rating::Karanari::matchGeneral(), osl::rating::DefenseKing8::matchMove(), osl::book::MiniBoard::MiniBoard(), osl::book::MiniBoardChar50::MiniBoardChar50(), osl::eval::ml::OpenMidEndingEval::OpenMidEndingEval(), osl::rating::Threatmate::Helper::operator()(), osl::operator<<(), osl::operator==(), osl::record::CsaFile::parseLine(), osl::kakinoki::KakinokiFile::parseLine(), osl::record::KanjiPrint::print(), osl::RepetitionCounter::push(), osl::usi::show(), osl::usi::strToMove(), osl::record::KanjiMove::strToMove(), osl::psn::strToMove(), osl::kakinoki::strToMove(), osl::csa::strToMove(), osl::eval::ml::OpenMidEndingEval::suggestMove(), osl::move_probability::ToEffect::supportAttack(), osl::book::MiniBoardChar50::toSimpleState(), osl::checkmate::Dfpn::tryProofMain(), osl::eval::ml::OpenMidEndingEval::update(), osl::progress::ml::NewProgress::update(), osl::progress::Effect5x3::update(), osl::move_probability::PatternCommon::updateCacheOne(), osl::progress::ml::NewProgress::updateMain(), and osl::progress::ml::NewProgress::updateSub().

◆ usedMask()

const PieceMask & osl::SimpleState::usedMask ( ) const
inline

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const SimpleState state 
)
friend

◆ operator==

bool operator== ( const SimpleState st1,
const SimpleState st2 
)
friend

盤上の駒のみを比較する(持ち駒は見ない).

なお、駒番に非依存な局面比較をしたい場合は、osl::record::CompactBoardや osl::hash::HashKeyを用いる.

Member Data Documentation

◆ board

CArray<Piece,Square::SIZE> osl::SimpleState::board
protected

Definition at line 43 of file simpleState.h.

Referenced by osl::NumEffectState::copyFrom(), getPiecePtr(), pieceAt(), and setBoard().

◆ hasPawnMask

const bool osl::SimpleState::hasPawnMask =true
static

Definition at line 41 of file simpleState.h.

◆ pawnMask

CArray<BitXmask,2> osl::SimpleState::pawnMask
protected

◆ pieces

CArray<Piece,Piece::SIZE> osl::SimpleState::pieces
protected

◆ player_to_move

Player osl::SimpleState::player_to_move
protected

手番

Definition at line 61 of file simpleState.h.

Referenced by changeTurn(), osl::NumEffectState::copyFrom(), setTurn(), and turn().

◆ stand_count

CArray<CArray<char,PTYPE_SIZE-PTYPE_BASIC_MIN>,2> osl::SimpleState::stand_count
protected

Definition at line 58 of file simpleState.h.

Referenced by osl::NumEffectState::copyFrom(), and countPiecesOnStand().

◆ stand_mask

CArray<PieceMask,2> osl::SimpleState::stand_mask
protected

Definition at line 56 of file simpleState.h.

Referenced by osl::NumEffectState::copyFrom(), standMask(), and standMask().

◆ used_mask

PieceMask osl::SimpleState::used_mask
protected

Definition at line 62 of file simpleState.h.

Referenced by osl::NumEffectState::copyFrom(), and usedMask().


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