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