Go to the documentation of this file.
3 #ifndef OSL_BOARD_TABLE_H
4 #define OSL_BOARD_TABLE_H
28 template<Direction Dir>
30 template<Direction Dir>
38 return offsets[
static_cast<int>(dir)];
41 return dxs[
static_cast<int>(dir)];
44 return dys[
static_cast<int>(dir)];
52 return getOffset<BLACK>(dir);
54 return getOffset<WHITE>(dir);
82 return getLongDirection<BLACK>(offset32);
84 return getLongDirection<WHITE>(offset32);
90 return getLongDirection<P>(
Offset32(to,from));
142 return getShort8Unsafe<BLACK>(from, to);
144 return getShort8Unsafe<WHITE>(from, to);
149 assert(from.
x()==to.
x() || from.
y()==to.
y() ||
150 abs(from.
x()-to.
x())==abs(from.
y()-to.
y()));
151 return getShort8Unsafe<P>(from,to);
157 assert(from.
x()==to.
x() || from.
y()==to.
y() ||
158 abs(from.
x()-to.
x())==abs(from.
y()-to.
y()));
CArray< int, Offset32Wide::SIZE > space_counts
CArray< signed char, Offset::ONBOARD_OFFSET_SIZE > short8Offset
bool isOnBoard() const
盤面上を表すかどうかの判定. 1<=x() && x()<=9 && 1<=y() && y()<=9 Squareの内部表現に依存する.
const BoardTable Board_Table
bool isBetweenSafe(Square t, Square p0, Square p1) const
constexpr Direction inverse(Direction d)
static const Offset makeDirect(int value)
Direction getLongDirection(Square from, Square to) const
Offset32Base< 8, 9 > Offset32
Direction getShort8Unsafe(Player P, Square from, Square to) const
const Offset getOffset(Player pl, Direction dir) const
Direction getLongDirection(Offset32 offset32) const
Direction getShort8(Square from, Square to) const
int getDyForBlack(Direction dir) const
const Offset32Base blackOffset32() const
Player P からみた offset を黒番のものに変更する
unsigned int uintValue() const
Offset getShort8OffsetUnsafe(Square from, Square to) const
8方向にいない場合も適当なものを返す.
@ DIRECTION_INVALID_VALUE
int getDxForBlack(Direction dir) const
static const CArray< int, DIRECTION_SIZE > dys
const Offset getShortOffsetNotKnight(Offset32 offset32) const
Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Knight以外のShortの利きのoffsetの場合はそれ自身を返す.
CArray< Offset, Offset32::SIZE > short_offsets
const Offset getOffsetForBlack(Direction dir) const
黒にとってのoffsetを返す
static const CArray< Offset, DIRECTION_SIZE > offsets
bool isValid(Player player)
cast等で作られたplayerが正しいかどうかを返す
int x() const
将棋としてのX座標を返す.
const Offset getOffset(Direction dir) const
const Square nextSquare(Player P, Square pos, Direction dr) const
next position from pos for player P.
void setKnightDirections()
Direction getShort8Unsafe(Square from, Square to) const
8方向にいない場合も適当なものを返す.
bool isBetween(Square t, Square p0, Square p1) const
p0, p1の間にtがあるかどうか.
int y() const
将棋としてのY座標を返す.
constexpr int sign(Player player)
CArray< Direction, Offset32::SIZE > directions
unsigned int index() const
const Offset getShortOffset(Offset32 offset32) const
Longの利きの可能性のあるoffsetの場合は, 反復に使う offsetを Shortの利きのoffsetの場合はそれ自身を返す.
CArray< unsigned char, Offset::ONBOARD_OFFSET_SIZE > short8Dir
CArray< Offset, Offset32::SIZE > short_offsets_not_knight
static const CArray< int, DIRECTION_SIZE > dxs
Direction getShort8(Square from, Square to, Offset &o) const
Direction getLongDirection(Player P, Offset32 offset32) const
int spaceCounts(Square from, Square to) const
fromとtoが長い利きを持つ位置にある時,間のマスの数を求める 一致している時は0 となりも0 関係ない時は-1