osl::BoardTable 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 | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
osl::BoardTable Class Reference

`#include <boardTable.h>`

Collaboration diagram for osl::BoardTable:
[legend]

## Public Member Functions
const Offset | getOffsetForBlack (Direction dir) const
| 黒にとってのoffsetを返す More...
int | getDxForBlack (Direction dir) const
int | getDyForBlack (Direction dir) const
template<Player P>
const Offset | getOffset (Direction dir) const
const Offset | getOffset (Player pl, Direction dir) const
const Square | nextSquare (Player P, Square pos, Direction dr) const
| next position from pos for player P. More...
| BoardTable ()
template<Player P>
Direction | getLongDirection (Offset32 offset32) const
Direction | getLongDirection (Player P, Offset32 offset32) const
template<Player P>
Direction | getLongDirection (Square from, Square to) const
int | spaceCounts (Square from, Square to) const
| fromとtoが長い利きを持つ位置にある時，間のマスの数を求める 一致している時は0 となりも0 関係ない時は-1 More...
const Offset | getShortOffset (Offset32 offset32) const
| Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Shortの利きのoffsetの場合はそれ自身を返す. More...
const Offset | getShortOffsetNotKnight (Offset32 offset32) const
| Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Knight以外のShortの利きのoffsetの場合はそれ自身を返す. More...
Offset | getShort8OffsetUnsafe (Square from, Square to) const
| 8方向にいない場合も適当なものを返す． More...
template<Player P>
Direction | getShort8Unsafe (Square from, Square to) const
| 8方向にいない場合も適当なものを返す． More...
Direction | getShort8Unsafe (Player P, Square from, Square to) const
template<Player P>
Direction | getShort8 (Square from, Square to) const
template<Player P>
Direction | getShort8 (Square from, Square to, Offset &o) const
bool | isBetween (Square t, Square p0, Square p1) const
| p0, p1の間にtがあるかどうか. More...
bool | isBetweenSafe (Square t, Square p0, Square p1) const

## Static Public Attributes
static const CArray< Offset, DIRECTION_SIZE > | offsets
static const CArray< int, DIRECTION_SIZE > | dxs
static const CArray< int, DIRECTION_SIZE > | dys

## Private Member Functions
template<Direction Dir>
void | setDirections ()
template<Direction Dir>
void | setKnightDirections ()
void | init ()

## Private Attributes
CArray< Direction, Offset32::SIZE > | directions
CArray< signed char, Offset::ONBOARD_OFFSET_SIZE > | short8Offset
CArray< unsigned char, Offset::ONBOARD_OFFSET_SIZE > | short8Dir
CArray< Offset, Offset32::SIZE > | short_offsets
CArray< Offset, Offset32::SIZE > | short_offsets_not_knight
CArray< int, Offset32Wide::SIZE > | space_counts

## Detailed Description

Definition at line 12 of file boardTable.h.

## Constructor & Destructor Documentation

osl::BoardTable::BoardTable | ( | ) |  |

Definition at line 65 of file boardTable.cc.

References osl::BLACK, and osl::UL.

## Member Function Documentation

int osl::BoardTable::getDxForBlack | ( | Direction | dir) |  | const
| inline

Definition at line 40 of file boardTable.h.

References dxs.

Referenced by osl::checkmate::ImmediateCheckmateTable::ImmediateCheckmateTable(), osl::PtypeTable::init(), osl::effect::Liberty8Table::longEffectOf(), and osl::effect::shortMaskOf().

int osl::BoardTable::getDyForBlack | ( | Direction | dir) |  | const
| inline

Definition at line 43 of file boardTable.h.

References dys.

Referenced by osl::checkmate::ImmediateCheckmateTable::ImmediateCheckmateTable(), osl::PtypeTable::init(), osl::effect::Liberty8Table::longEffectOf(), and osl::effect::shortMaskOf().

template<Player P>

Direction osl::BoardTable::getLongDirection | ( | Offset32 | offset32) |  | const
| inline

Parameters

  P | どちらのPlayerにとっての方向かを指定

Definition at line 71 of file boardTable.h.

References osl::Offset32Base< Width, Width2 >::blackOffset32(), directions, osl::Offset32Base< Width, Width2 >::isValid(), and osl::isValid().

Referenced by osl::move_probability::BlockLong::addPiece(), osl::effect_util::AdditionalOrShadow::count(), osl::checkmate::ProofNumberTable::countLibertyLong(), osl::effect::directionOf(), osl::eval::TakeBackValue::findEffectPiecesAfterMove(), osl::move_action::EscapeFilter< P, OrigAction >::findThreat(), osl::move_generator::without_effect::generateLongMove(), osl::move_generator::addeffect8::generateLongMove(), osl::state::NumEffectState::hasEffectByWithRemove(), osl::state::NumEffectState::hasEffectInDirection(), osl::effect_util::Neighboring8Direct::Table::hasEffectOrAdditional(), osl::effect::AddMaskAction< Liberty, P, T >::operator()(), osl::state::NumEffectState::recalcPinOpen(), and osl::move_action::EscapeFilter< P, OrigAction >::suitable().

Direction osl::BoardTable::getLongDirection | ( | Player | P,
|  | Offset32 | offset32
| ) |  | const
| inline

Definition at line 79 of file boardTable.h.

References osl::BLACK.

template<Player P>

Direction osl::BoardTable::getLongDirection | ( | Square | from,
|  | Square | to
| ) |  | const
| inline

Parameters

  P | どちらのPlayerにとっての方向かを指定

Definition at line 88 of file boardTable.h.

template<Player P>

const Offset osl::BoardTable::getOffset | ( | Direction | dir) |  | const
| inline

Definition at line 47 of file boardTable.h.

References getOffsetForBlack(), and osl::playerToMul().

Referenced by osl::move_probability::AddEffectLong::addOne(), osl::move_probability::KingBlockade::blockAll(), osl::move_classifier::PawnDropCheckmate< P >::canEscape(), osl::move_probability::StateInfo::clearOldCache(), osl::checkmate::EdgeTable::EdgeTable(), osl::rating::PatternLong2::find(), osl::move_probability::StateInfo::findCheckmateDefender(), osl::effect_util::VirtualPin::findDirection(), osl::effect_util::Pin::findDirection(), osl::search::BreakThreatmate::generate(), osl::move_generator::OpenKingRoad< P >::generateDir(), osl::checkmate::ImmediateCheckmate::hasCheckmateMoveDir(), osl::effect_util::Neighboring8Direct::Table::init(), osl::effect_util::Neighboring8Effect::Table::init(), osl::checkmate::ProofNumberTable::libertyAfterAllMove(), osl::move_probability::LanceAttack::match(), osl::move_probability::LureDefender::match(), osl::move_probability::OpposingPawn::match(), osl::move_probability::DropAfterOpposingPawn::match(), osl::move_probability::CoverPawn::match(), osl::move_probability::KingBlockade::match(), osl::eval::ml::SilverFork::matchGold(), osl::eval::ml::SilverFork::matchRook(), osl::rating::PatternLong::nextPieceOrEnd(), nextSquare(), osl::Offset::Offset(), osl::effect::AddMaskAction< Liberty, P, T >::operator()(), osl::checkmate::detail::slowCheckDrop(), osl::checkmate::ImmediateCheckmate::slowHasCheckmateMoveDirPiece(), and osl::move_probability::StateInfo::updatePinnedGenerals().

const Offset osl::BoardTable::getOffset | ( | Player | pl,
|  | Direction | dir
| ) |  | const
| inline

Definition at line 50 of file boardTable.h.

References osl::BLACK.

const Offset osl::BoardTable::getOffsetForBlack | ( | Direction | dir) |  | const
| inline

黒にとってのoffsetを返す

Definition at line 37 of file boardTable.h.

References offsets.

Referenced by osl::effect::EffectedNumTable::EffectedNumTable(), osl::move_generator::AddEffect8Defense< P >::generate(), osl::move_generator::CaptureEffectToAroundKing8< P >::generate(), getOffset(), osl::effect_util::Neighboring8Effect::hasEffectFromTo(), osl::effect_util::Neighboring8Direct::hasEffectFromTo(), osl::move_action::ToAroundKing24Filter< P, OrigAction >::isToAroundKing24Move(), osl::move_action::ToAroundKing8Filter< P, OrigAction >::isToAroundKing8Move(), osl::move_probability::BlockLong::makeLongAttackOne(), and osl::state::NumEffectState::recalcPinOpen().

template<Player P>

Direction osl::BoardTable::getShort8 | ( | Square | from,
|  | Square | to
| ) |  | const
| inline

Definition at line 147 of file boardTable.h.

References osl::Square::isOnBoard(), osl::Square::x(), and osl::Square::y().

Referenced by osl::checkmate::ProofNumberTable::countLibertyShortNotKnight(), osl::effect::NumSimpleEffectTable::doBlockAt(), osl::effect_util::AdditionalEffect::hasEffect(), osl::move_classifier::KingOpenMove< P >::isMember(), osl::checkmate::King8Info::make(), and osl::state::NumEffectState::pinnedDir().

template<Player P>

Direction osl::BoardTable::getShort8 | ( | Square | from,
|  | Square | to,
|  | Offset & | o
| ) |  | const
| inline

Definition at line 155 of file boardTable.h.

References osl::BLACK, osl::inverse(), osl::Square::isOnBoard(), osl::Offset::makeDirect(), osl::Offset::ONBOARD_OFFSET_MIN, short8Dir, short8Offset, osl::Square::uintValue(), osl::Square::x(), and osl::Square::y().

Offset osl::BoardTable::getShort8OffsetUnsafe | ( | Square | from,
|  | Square | to
| ) |  | const
| inline

8方向にいない場合も適当なものを返す．

Definition at line 126 of file boardTable.h.

References osl::Offset::makeDirect(), osl::Offset::ONBOARD_OFFSET_MIN, short8Offset, and osl::Square::uintValue().

Referenced by osl::checkmate::detail::blockingDiagonalAttack(), and osl::move_generator::detail::generateOpenOrCapture().

template<Player P>

Direction osl::BoardTable::getShort8Unsafe | ( | Square | from,
|  | Square | to
| ) |  | const
| inline

8方向にいない場合も適当なものを返す．

Definition at line 134 of file boardTable.h.

References osl::BLACK, osl::Offset::ONBOARD_OFFSET_MIN, short8Dir, and osl::Square::uintValue().

Referenced by osl::move_generator::PieceOnBoard< Action, noCapturePromote >::generatePiece(), osl::move_generator::PieceOnBoard< Action, noCapturePromote >::generatePiecePtype(), osl::move_generator::detail::generateRookLongMoveNotKing(), osl::checkmate::ImmediateCheckmate::hasCheckmateMoveDirPiece(), osl::move_classifier::KingOpenMove< P >::isMember(), osl::state::NumEffectState::pinnedCanMoveTo(), and osl::state::NumEffectState::wasCheckEvasion().

Direction osl::BoardTable::getShort8Unsafe | ( | Player | P,
|  | Square | from,
|  | Square | to
| ) |  | const
| inline

Definition at line 140 of file boardTable.h.

References osl::BLACK.

const Offset osl::BoardTable::getShortOffset | ( | Offset32 | offset32) |  | const
| inline

Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Shortの利きのoffsetの場合はそれ自身を返す.

利きの可能性のない場合は0を返す

Definition at line 110 of file boardTable.h.

References osl::Offset32Base< Width, Width2 >::index(), osl::Offset32Base< Width, Width2 >::isValid(), and short_offsets.

Referenced by osl::move_generator::detail::blockingU(), osl::move_generator::addeffect8::canAddLongEffect(), osl::search::QuiescenceGenerator< P >::escapeByMoveOnly(), osl::search::QuiescenceGenerator< P >::escapeNormalPiece(), osl::rating::PatternBlock::find(), osl::eval::ml::BishopRookFork::findDropInLine(), osl::search::BreakThreatmate::generate(), osl::move_generator::Escape< Action >::generateBlocking(), osl::move_generator::Escape< Action >::generateBlockingKing(), osl::move_generator::without_effect::generateLongMove(), osl::effect_util::Neighboring8Effect::Table::hasAtMaxPieceBetween(), osl::state::NumEffectState::hasEffectIf(), osl::effect_util::Neighboring8Direct::Table::hasEffectOrAdditional(), osl::effect::hasShortMove(), osl::state::SimpleState::isEmptyBetween(), osl::move_generator::without_effect::isEmptyOrAdditional(), and osl::move_classifier::BlockLongEffect< P, T >::isMember().

const Offset osl::BoardTable::getShortOffsetNotKnight | ( | Offset32 | offset32) |  | const
| inline

Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Knight以外のShortの利きのoffsetの場合はそれ自身を返す.

Knightの利き, 利きの可能性のない場合は0を返す

Definition at line 119 of file boardTable.h.

References osl::Offset32Base< Width, Width2 >::index(), osl::Offset32Base< Width, Width2 >::isValid(), and short_offsets_not_knight.

Referenced by osl::checkmate::OracleAdjust::attack(), osl::move_classifier::PawnDropCheckmate< P >::canEscape(), osl::checkmate::ProofNumberTable::countLibertyLong(), osl::move_probability::CoverFork::defending(), osl::effect_util::AdditionalEffect::find(), osl::eval::See::findAdditionalPieces(), osl::search::BreakThreatmate::findBlockLong(), osl::eval::TakeBackValue::findEffectPiecesAfterMove(), osl::search::BreakThreatmate::generate(), osl::checkmate::ImmediateCheckmateTable::ImmediateCheckmateTable(), isBetweenSafe(), osl::move_classifier::KingOpenMove< P >::isMemberMain(), osl::Neighboring8::isNeighboring8(), osl::move_probability::BlockLong::makeLongAttackOne(), and osl::move_probability::PromotionBySacrifice::match().

void osl::BoardTable::init | ( | ) |  |
| private

Definition at line 45 of file boardTable.cc.

References osl::DIRECTION_INVALID_VALUE.

bool osl::BoardTable::isBetween | ( | Square | t,
|  | Square | p0,
|  | Square | p1
| ) |  | const
| inline

p0, p1の間にtがあるかどうか.

(t,p0), (t,p1)のどちらかが8方向である時にのみ呼び出すこと 他方も8方向でないとしたらknightの関係

Definition at line 172 of file boardTable.h.

References osl::DIRECTION_INVALID_VALUE, osl::Offset::ONBOARD_OFFSET_MIN, short8Dir, and osl::Square::uintValue().

Referenced by osl::move_probability::CoverFork::defending(), isBetweenSafe(), osl::move_probability::BlockLong::makeLongAttackOne(), osl::checkmate::detail::slowCheckDrop(), and osl::checkmate::ImmediateCheckmate::slowHasCheckmateMoveDirPiece().

bool osl::BoardTable::isBetweenSafe | ( | Square | t,
|  | Square | p0,
|  | Square | p1
| ) |  | const
| inline

Definition at line 179 of file boardTable.h.

References getShortOffsetNotKnight(), and isBetween().

Referenced by osl::state::NumEffectState::wasCheckEvasion().

const Square osl::BoardTable::nextSquare | ( | Player | P,
|  | Square | pos,
|  | Direction | dr
| ) |  | const
| inline

next position from pos for player P.

答えが isOnBoard とは限らない

Definition at line 61 of file boardTable.h.

References getOffset(), and osl::Square::isOnBoard().

Referenced by osl::Square::back(), osl::search::QuiescenceGenerator< P >::breakThreatmate(), osl::eval::ProgressEvalGeneral< OpeningEval >::calculateGoldPenalty(), osl::eval::ProgressEvalGeneral< OpeningEval >::calculateSilverPenalty(), osl::eval::ml::PawnAdvanceUtil::cantAdvance(), osl::rating::Threatmate::captureForKnightCheck(), osl::eval::ml::NumPiecesBetweenBishopAndKing::countBetween(), osl::checkmate::CheckmateIfCapture::effectiveAttackCandidate0(), osl::eval::ml::King8Effect::effectState(), osl::eval::ml::King8EffectAll::effectState(), osl::eval::ml::KnightHead::eval(), osl::eval::ml::PawnPtypeOPtypeO::eval(), osl::effect_util::UnblockableEffect::find(), osl::rating::BadLanceGroup::findMatch(), osl::rating::BadLance::match(), osl::Square::neighbor(), osl::rating::Pattern::nextSquare(), osl::eval::ml::King8EffectBase::MakeEffectStateSimple::operator()(), and osl::eval::ml::King8EffectBase::MakeEffectStateDefense::operator()().

template<osl::Direction Dir>

void osl::BoardTable::setDirections | ( | ) |  |
| private

Definition at line 7 of file boardTable.cc.

References directions, osl::Offset32Base< Width, Width2 >::index(), osl::Offset::intValue(), osl::longToShort(), osl::Offset::ONBOARD_OFFSET_MIN, short8Dir, short8Offset, short_offsets, short_offsets_not_knight, and space_counts.

template<osl::Direction Dir>

void osl::BoardTable::setKnightDirections | ( | ) |  |
| private

Definition at line 36 of file boardTable.cc.

References osl::Offset32Base< Width, Width2 >::index().

int osl::BoardTable::spaceCounts | ( | Square | from,
|  | Square | to
| ) |  | const
| inline

fromとtoが長い利きを持つ位置にある時，間のマスの数を求める 一致している時は0 となりも0 関係ない時は-1

Definition at line 99 of file boardTable.h.

References osl::Offset32Base< Width, Width2 >::index(), and space_counts.

## Member Data Documentation

CArray<Direction,Offset32::SIZE> osl::BoardTable::directions
| private

Definition at line 14 of file boardTable.h.

Referenced by getLongDirection(), and setDirections().

const CArray< int, DIRECTION_SIZE > osl::BoardTable::dxs
| static

Initial value:
= { {
DirectionTraits<static_cast<Direction>(0)>::blackDx,
DirectionTraits<static_cast<Direction>(1)>::blackDx,
DirectionTraits<static_cast<Direction>(2)>::blackDx,
DirectionTraits<static_cast<Direction>(3)>::blackDx,
DirectionTraits<static_cast<Direction>(4)>::blackDx,
DirectionTraits<static_cast<Direction>(5)>::blackDx,
DirectionTraits<static_cast<Direction>(6)>::blackDx,
DirectionTraits<static_cast<Direction>(7)>::blackDx,
DirectionTraits<static_cast<Direction>(8)>::blackDx,
DirectionTraits<static_cast<Direction>(9)>::blackDx,
DirectionTraits<static_cast<Direction>(10)>::blackDx,
DirectionTraits<static_cast<Direction>(11)>::blackDx,
DirectionTraits<static_cast<Direction>(12)>::blackDx,
DirectionTraits<static_cast<Direction>(13)>::blackDx,
DirectionTraits<static_cast<Direction>(14)>::blackDx,
DirectionTraits<static_cast<Direction>(15)>::blackDx,
DirectionTraits<static_cast<Direction>(16)>::blackDx,
DirectionTraits<static_cast<Direction>(17)>::blackDx
} }

Definition at line 25 of file boardTable.h.

Referenced by getDxForBlack().

const CArray< int, DIRECTION_SIZE > osl::BoardTable::dys
| static

Initial value:
= { {
DirectionTraits<static_cast<Direction>(0)>::blackDy,
DirectionTraits<static_cast<Direction>(1)>::blackDy,
DirectionTraits<static_cast<Direction>(2)>::blackDy,
DirectionTraits<static_cast<Direction>(3)>::blackDy,
DirectionTraits<static_cast<Direction>(4)>::blackDy,
DirectionTraits<static_cast<Direction>(5)>::blackDy,
DirectionTraits<static_cast<Direction>(6)>::blackDy,
DirectionTraits<static_cast<Direction>(7)>::blackDy,
DirectionTraits<static_cast<Direction>(8)>::blackDy,
DirectionTraits<static_cast<Direction>(9)>::blackDy,
DirectionTraits<static_cast<Direction>(10)>::blackDy,
DirectionTraits<static_cast<Direction>(11)>::blackDy,
DirectionTraits<static_cast<Direction>(12)>::blackDy,
DirectionTraits<static_cast<Direction>(13)>::blackDy,
DirectionTraits<static_cast<Direction>(14)>::blackDy,
DirectionTraits<static_cast<Direction>(15)>::blackDy,
DirectionTraits<static_cast<Direction>(16)>::blackDy,
DirectionTraits<static_cast<Direction>(17)>::blackDy
} }

Definition at line 26 of file boardTable.h.

Referenced by getDyForBlack().

const CArray< Offset, DIRECTION_SIZE > osl::BoardTable::offsets
| static

Initial value:
= { {
DirectionTraits<static_cast<Direction>(0)>::blackOffset(),
DirectionTraits<static_cast<Direction>(1)>::blackOffset(),
DirectionTraits<static_cast<Direction>(2)>::blackOffset(),
DirectionTraits<static_cast<Direction>(3)>::blackOffset(),
DirectionTraits<static_cast<Direction>(4)>::blackOffset(),
DirectionTraits<static_cast<Direction>(5)>::blackOffset(),
DirectionTraits<static_cast<Direction>(6)>::blackOffset(),
DirectionTraits<static_cast<Direction>(7)>::blackOffset(),
DirectionTraits<static_cast<Direction>(8)>::blackOffset(),
DirectionTraits<static_cast<Direction>(9)>::blackOffset(),
DirectionTraits<static_cast<Direction>(10)>::blackOffset(),
DirectionTraits<static_cast<Direction>(11)>::blackOffset(),
DirectionTraits<static_cast<Direction>(12)>::blackOffset(),
DirectionTraits<static_cast<Direction>(13)>::blackOffset(),
DirectionTraits<static_cast<Direction>(14)>::blackOffset(),
DirectionTraits<static_cast<Direction>(15)>::blackOffset(),
DirectionTraits<static_cast<Direction>(16)>::blackOffset(),
DirectionTraits<static_cast<Direction>(17)>::blackOffset()
} }

Definition at line 24 of file boardTable.h.

Referenced by getOffsetForBlack().

CArray<unsigned char,Offset::ONBOARD_OFFSET_SIZE> osl::BoardTable::short8Dir
| private

Definition at line 17 of file boardTable.h.

Referenced by getShort8(), getShort8Unsafe(), isBetween(), and setDirections().

CArray<signed char,Offset::ONBOARD_OFFSET_SIZE> osl::BoardTable::short8Offset
| private

Definition at line 16 of file boardTable.h.

Referenced by getShort8(), getShort8OffsetUnsafe(), and setDirections().

CArray<Offset, Offset32::SIZE> osl::BoardTable::short_offsets
| private

Definition at line 18 of file boardTable.h.

Referenced by getShortOffset(), and setDirections().

CArray<Offset, Offset32::SIZE> osl::BoardTable::short_offsets_not_knight
| private

Definition at line 19 of file boardTable.h.

Referenced by getShortOffsetNotKnight(), and setDirections().

CArray<int,Offset32Wide::SIZE> osl::BoardTable::space_counts
| private

Definition at line 21 of file boardTable.h.

Referenced by setDirections(), and spaceCounts().

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

- boardTable.h
- boardTable.cc
- tables.cc