My Project
osl::BoardTable Class Reference

#include <boardTable.h>

Public Member Functions

const Offset getOffsetForBlack (Direction dir) const
 黒にとってのoffsetを返す
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.
 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
const Offset getShortOffset (Offset32 offset32) const
 Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Shortの利きのoffsetの場合はそれ自身を返す.
const Offset getShortOffsetNotKnight (Offset32 offset32) const
 Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Knight以外のShortの利きのoffsetの場合はそれ自身を返す.
Offset getShort8OffsetUnsafe (Square from, Square to) const
 8方向にいない場合も適当なものを返す.
template<Player P>
Direction getShort8Unsafe (Square from, Square to) const
 8方向にいない場合も適当なものを返す.
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があるかどうか.
bool isBetweenSafe (Square t, Square p0, Square p1) const

Static Public Attributes

static const CArray< Offset, DIRECTION_SIZEoffsets
static const CArray< int, DIRECTION_SIZEdxs
static const CArray< int, DIRECTION_SIZEdys

Private Member Functions

template<Direction Dir>
void setDirections ()
template<Direction Dir>
void setKnightDirections ()
void init ()

Private Attributes

CArray< Direction, Offset32::SIZEdirections
CArray< signed char, Offset::ONBOARD_OFFSET_SIZEshort8Offset
CArray< unsigned char, Offset::ONBOARD_OFFSET_SIZEshort8Dir
CArray< Offset, Offset32::SIZEshort_offsets
CArray< Offset, Offset32::SIZEshort_offsets_not_knight
CArray< int, Offset32Wide::SIZEspace_counts

Detailed Description

Definition at line 12 of file boardTable.h.

Constructor & Destructor Documentation

◆ BoardTable()

osl::BoardTable::BoardTable ( )

Definition at line 65 of file boardTable.cc.

References osl::BLACK, getOffset(), init(), and osl::UL.

Member Function Documentation

◆ getDxForBlack()

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

Definition at line 40 of file boardTable.h.

References dxs.

◆ getDyForBlack()

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

Definition at line 43 of file boardTable.h.

References dys.

◆ getLongDirection() [1/3]

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 >::index(), osl::isValid(), and osl::Offset32Base< Width, Width2 >::isValid().

Referenced by getLongDirection(), and getLongDirection().

◆ getLongDirection() [2/3]

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

Definition at line 79 of file boardTable.h.

References osl::BLACK, and getLongDirection().

◆ getLongDirection() [3/3]

template<Player P>
Direction osl::BoardTable::getLongDirection ( Square from,
Square to ) const
inline
Parameters
PどちらのPlayerにとっての方向かを指定

Definition at line 88 of file boardTable.h.

References getLongDirection().

◆ getOffset() [1/2]

template<Player P>
const Offset osl::BoardTable::getOffset ( Direction dir) const
inline

Definition at line 47 of file boardTable.h.

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

Referenced by BoardTable(), getOffset(), and nextSquare().

◆ getOffset() [2/2]

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

Definition at line 50 of file boardTable.h.

References osl::BLACK, and getOffset().

◆ getOffsetForBlack()

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

黒にとってのoffsetを返す

Definition at line 37 of file boardTable.h.

References offsets.

Referenced by getOffset().

◆ getShort8() [1/2]

template<Player P>
Direction osl::BoardTable::getShort8 ( Square from,
Square to ) const
inline

◆ getShort8() [2/2]

◆ getShort8OffsetUnsafe()

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().

◆ getShort8Unsafe() [1/2]

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

Definition at line 140 of file boardTable.h.

References osl::BLACK, and getShort8Unsafe().

◆ getShort8Unsafe() [2/2]

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 getShort8(), and getShort8Unsafe().

◆ getShortOffset()

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.

◆ getShortOffsetNotKnight()

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 isBetweenSafe().

◆ init()

void osl::BoardTable::init ( )
private

◆ isBetween()

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 isBetweenSafe().

◆ isBetweenSafe()

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

Definition at line 179 of file boardTable.h.

References getShortOffsetNotKnight(), and isBetween().

◆ nextSquare()

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().

◆ setDirections()

◆ setKnightDirections()

template<osl::Direction Dir>
void osl::BoardTable::setKnightDirections ( )
private

◆ spaceCounts()

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

◆ directions

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

Definition at line 14 of file boardTable.h.

Referenced by getLongDirection(), init(), and setDirections().

◆ dxs

◆ dys

◆ offsets

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

◆ short8Dir

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

Definition at line 17 of file boardTable.h.

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

◆ short8Offset

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

Definition at line 16 of file boardTable.h.

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

◆ short_offsets

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

Definition at line 18 of file boardTable.h.

Referenced by getShortOffset(), setDirections(), and setKnightDirections().

◆ short_offsets_not_knight

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

Definition at line 19 of file boardTable.h.

Referenced by getShortOffsetNotKnight(), init(), and setDirections().

◆ space_counts

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

Definition at line 21 of file boardTable.h.

Referenced by init(), setDirections(), and spaceCounts().


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